我將一個對ini file進行操作的類加入到我的工程中使用,但編譯時出錯,為什么呢?
可是在c++ builder中卻可以編譯通過,不知在vc++ 6.0中為什么不行?
出錯提示如下:
--------------------Configuration: ReadIniFiles - Win32 Debug--------------------
Compiling...
AnsiStrg.cpp
Debug.cpp
e:\myprogram\inifiles\readinifiles\debug.cpp(45) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Inifiles.cpp
e:\myprogram\inifiles\readinifiles\inifiles.cpp(637) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Ansistr.cpp
e:\myprogram\inifiles\readinifiles\ansistr.cpp(517) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Generating Code...
Error executing cl.exe.ReadIniFiles.exe - 3 error(s), 0 warning(s)謝謝!

解决方案 »

  1.   

    在你的CPP文件第一行加上“stdafx.h”
      

  2.   

    謝謝!我加入了"stdafx.h",原先的錯誤已沒有了,但又出現了新的錯誤,如下
    Compiling...
    Inifiles.cpp
    E:\myprogram\Inifiles\ReadIniFiles\Inifiles.cpp(59) : error C2653: 'IniLine' : is not a class or namespace name
    E:\myprogram\Inifiles\ReadIniFiles\Inifiles.cpp(61) : error C2065: 'Next' : undeclared identifier
    E:\myprogram\Inifiles\ReadIniFiles\Inifiles.cpp(63) : error C2541: delete : cannot delete objects that are not pointers
    E:\myprogram\Inifiles\ReadIniFiles\Inifiles.cpp(66) : warning C4508: 'IniLine' : function should return a value; 'void' return type assumed
    E:\myprogram\Inifiles\ReadIniFiles\Inifiles.cpp(69) : error C2653: 'IniLine' : is not a class or namespace name
    E:\myprogram\Inifiles\ReadIniFiles\Inifiles.cpp(69) : error C2146: syntax error : missing ';' before identifier 'GetType'
    E:\myprogram\Inifiles\ReadIniFiles\Inifiles.cpp(69) : error C2501: 'IniLineType' : missing storage-class or type specifiers
    E:\myprogram\Inifiles\ReadIniFiles\Inifiles.cpp(69) : fatal error C1004: unexpected end of file found
    Error executing cl.exe.ReadIniFiles.exe - 7 error(s), 1 warning(s)
    因為在c++ builder中能用啊,為什么會不行呢?