在StdAfx.h中写入msado15.dll出错
为什么我在StdAfx.h中写了这句话
#import "C:\Program Files\Common Files\System\ado\msado15.dll " no_namespace
rename( "EOF ", "adoEOF ")
后出现一堆错误?!。。。
--------------------Configuration: Rent - Win32 Debug--------------------
Compiling...
StdAfx.cpp
d:\c++\rent\debug\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\c++\rent\debug\msado15.tlh(1316) : error C2629: unexpected 'short ( '
d:\c++\rent\debug\msado15.tlh(1316) : error C2238: unexpected token(s) preceding '; '
d:\c++\rent\stdafx.cpp(5) : error C2501: 'rename ' : missing storage-class or type specifiers
d:\c++\rent\stdafx.cpp(5) : error C2373: 'rename ' : redefinition; different type modifiers
d:\program files\microsoft visual studio\vc98\include\stdio.h(335) : see declaration of 'rename '
d:\c++\rent\stdafx.cpp(5) : error C2078: too many initializers
d:\c++\rent\stdafx.cpp(5) : error C2440: 'initializing ' : cannot convert from 'char [7] ' to 'int '
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
d:\c++\rent\stdafx.cpp(5) : error C2143: syntax error : missing '; ' before 'PCH creation point '
Error executing cl.exe.
Creating browse info file...
Rent.exe - 7 error(s), 1 warning(s)
[解决办法]
你这一长串东西要一行写完,如:
#import "C:\Program Files\Common Files\System\ado\msado15.dll " no_namespace rename( "EOF ", "adoEOF ")