你是不是用VC 的Wizard生成了工程,如果是这样,你需要在hellowld.cpp前加上#include "stdafx.h"

解决方案 »

  1.   

    首先谢谢你的帮助,我还以为没人理我了。不过我的项目是一个:
    《Win32 Dynamic-Link Library》的空项目。你说的stdafx.h文件该怎么产生呢?
    虽然没有,但我还是试着把你说的话加入了进去,但还是报错:
    (我觉得系统好像使用了RealSDK的"stdafx.h"了。我该如何是好?--------------------Configuration: hellowld - Win32 Debug--------------------
    Compiling...
    hellowld.cpp
    c:\program files\microsoft visual studio\vc98\atl\include\atliface.h(2055) : error C2065: 'GUID_NULL' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\atl\include\atliface.h(2055) : error C2440: 'default argument' : cannot convert from 'int' to 'const struct _GUID &'
            Reason: cannot convert from 'int' to 'const struct _GUID'
            No constructor could take the source type, or constructor overload resolution was ambiguous
    c:\program files\microsoft visual studio\vc98\atl\include\atliface.h(2055) : error C2548: 'AtlAxCreateControlEx' : missing default parameter for parameter 6
    c:\program files\microsoft visual studio\vc98\mfc\include\afxole.h(469) : error C2440: 'default argument' : cannot convert from 'int' to 'const struct _GUID &'
            Reason: cannot convert from 'int' to 'const struct _GUID'
            No constructor could take the source type, or constructor overload resolution was ambiguous
    c:\unzipped\rsg2sdk_r4\rmasdk_6_0\include\pntypes.h(39) : fatal error C1189: #error :  For VC++ 6.0 or higher you must include pntypes.h before other windows header files.
    Error executing cl.exe.hellowld.dll - 5 error(s), 0 warning(s)
      

  2.   

    几乎用不到什么代码,你看看我的步骤:
    先生成一个《Win32 Dynamic-Link Library》的项目(注明:空项目和简单项目我都试过),里面什么也不写。
    然后把SDK的两个文件《hellowld.cpp》和《hellowld.h》包含进我的项目。我按照xpmao() 兄的提示,把《stdafx.h》包含在《hellowld.cpp》中,但现在又出现新的提示:
    Compiling...
    filefmt1.cpp
    c:\unzipped\rsg2sdk_r4\rmasdk_6_0\include\pntypes.h(39) : fatal error C1189: #error :  For VC++ 6.0 or higher you must include pntypes.h before other windows header files.
    Error executing cl.exe.test1.dll - 1 error(s), 0 warning(s)编译器发现了RealSDK的一个文件有错误. 怎么用别人的程序这么麻烦啊?
      

  3.   

    安装VC后,再安装SDK, 你就可以使用在VC中使用SDK环境了.至于你的错误, 都是一些头文件包含错了所引起的. 调整调整就行了.对了,还有一点,在你的Tools->Options->Directories页中,
    show directories for 的几个目录尽量把SDK的排前.
      

  4.   

    你说的太对了。我也知道是《一些头文件包含错了所引起的》。只是我现在还没学会调整的技巧。我无论怎么调整,它还是报错。
    目录的调整我也试过,我把realsdk的目录放在每个位置上都试过。可一点反应也没有。顺便说一句。我在公司编程,有不少我们以前干的工程的包含文件目录在Tools->Options->Directories中。又不能删,不知道是不是它们闹的。
      

  5.   

    #include <windows.h>
    不需要stdafx.h