Microsoft的头文件编译出错?

Nicky_he 2001-07-16 03:44:58
一个很简单的dialog base程序。
#include "lmremutl.h"

....
随便建个button ,OnBtn1中写。
{
TIME_OF_DAY_INFO * todinfo;
}
竟然编译通不过。
出错信息为:
--------------------Configuration: NetRemoteTime - Win32 Release--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
NetRemoteTime.cpp
NetRemoteTimeDlg.cpp
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\lmremutl.h(53) : error C2146: syntax error : missing ';' before identifier 'NET_API_FUNCTION'

C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\lmremutl.h(53) : error C2501: 'NET_API_STATUS' : missing storage-class or type specifiers

C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\lmremutl.h(53) : fatal error C1004: unexpected end of file found
Generating Code...
Error executing cl.exe.

NetRemoteTime.exe - 3 error(s), 0 warning(s)
以下为出错头文件的函数声明
NET_API_STATUS NET_API_FUNCTION
NetRemoteTOD (
IN LPCWSTR UncServerName,
OUT LPBYTE *BufferPtr
);
到底是哪里问题呢?
我应该如何改才能通过编译?
...全文
77 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Nicky_he 2001-07-19
  • 打赏
  • 举报
回复
up
Nicky_he 2001-07-18
  • 打赏
  • 举报
回复
没人用过NetRemoteTOD函数吗?
Nicky_he 2001-07-17
  • 打赏
  • 举报
回复
问题已经自己解决了,是要再Include "lm.h"这个头文件。
不过问题又来了,同样的NetRemoteTOD函数。
我用VC6写,运行时告诉我找不到服务器。
但我用Delphi写,却又运行正常。
我把VC的代码贴在下面,希望高手帮我看看。
void CNetRemoteTimeDlg::OnBtndt()
{
// TODO: Add your control notification handler code here
TIME_OF_DAY_INFO * todinfo;
int SrvNameLen;
LPBYTE buffer;
NET_API_STATUS nas;
char msg[100];
LPWSTR tmps;
UpdateData(true);
SrvNameLen=m_SrvName.GetLength() ;
try
{
tmps=(LPWSTR)m_SrvName.GetBuffer(SrvNameLen);
TRACE1("<>%s\n",tmps);
nas=NetRemoteTOD(tmps, & buffer);
if (nas==0 )
{
todinfo=(TIME_OF_DAY_INFO *)buffer;
m_SrvTime.Format("%li-%li-%li %li:%li:%li",todinfo->tod_year,todinfo->tod_month,
todinfo->tod_day,todinfo->tod_hours ,
todinfo->tod_mins,todinfo->tod_secs);
UpdateData(false);
}
else
{
sprintf(msg,"%s Error code:%d","Can't not get time",nas);
AfxMessageBox(msg,MB_OK);
}
}
catch(char * exception)
{
AfxMessageBox(exception,MB_OK);
NetApiBufferFree(todinfo);
}
}
huangbeyond 2001-07-16
  • 打赏
  • 举报
回复
把#include "lmremutl.h"这一行,
写在所有的#include。。。。后面
nustchen 2001-07-16
  • 打赏
  • 举报
回复
要#include "stdafx.h"才行

16,465

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧