Question

I'm trying to work with some library code given to me that requires some of the ATL functionality but I consistently get errors like the following:

1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atltransactionmanager.h(396): error C2039: 'CreateFile' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atltransactionmanager.h(427): error C2039: 'DeleteFile' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atltransactionmanager.h(460): error C2039: 'MoveFile' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atlbase.h(6517): error C2039: 'GetModuleFileName' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atlbase.h(6517): error C3861: 'GetModuleFileName': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atlbase.h(6591): error C2039: 'GetModuleFileName' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atlbase.h(6591): error C3861: 'GetModuleFileName': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\statreg.h(481): error C3861: 'FindResource': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\statreg.h(674): error C3861: 'CreateFile': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atlbase.h(6676): error C3861: 'GetModuleFileName': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atlbase.h(6762): error C3861: 'GetModuleFileName': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atlbase.h(6885): error C3861: 'GetModuleFileName': identifier not found
1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\atlbase.h(7228): error C3861: 'GetModuleFileName': identifier not found
1>c:\program files (x86)\microsoft sdks\speech\v11.0\include\sphelper.h(1246): error C2039: 'LoadLibrary' : is not a member of '`global namespace''
1>c:\program files (x86)\microsoft sdks\speech\v11.0\include\sphelper.h(1246): error C3861: 'LoadLibrary': identifier not found

I do have it installed on my own machine and the original project itself compiles without problem. For confidentiality reasons I can't share the original project itself, but I can share its compile flags (apologies for poor formatting):

/Yc"stdafx.h" /GS /analyze- /W3 /wd"4995" /Zc:wchar_t /ZI /Gm /Od /Fd"Debug\vc110.pdb" /fp:precise /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "DLL_EXPORTS" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /Oy- /MDd /Fa"Debug\" /EHsc /nologo /Fo"Debug\" /Fp"Debug\KinectCommonBridge.pch" 

Here are mine (feel free to ignore the openFrameworks related includes, I'm trying to keep the project as close to their settings as possible so that it translates more easily for users):

/Yc"stdafx.h" /GS /TP /analyze- /W3 /Zc:wchar_t /I"..\..\..\libs\openFrameworks" /I"..\..\..\libs\openFrameworks\graphics" /I"..\..\..\libs\openFrameworks\app" /I"..\..\..\libs\openFrameworks\sound" /I"..\..\..\libs\openFrameworks\utils" /I"..\..\..\libs\openFrameworks\communication" /I"..\..\..\libs\openFrameworks\video" /I"..\..\..\libs\openFrameworks\types" /I"..\..\..\libs\openFrameworks\math" /I"..\..\..\libs\openFrameworks\3d" /I"..\..\..\libs\openFrameworks\gl" /I"..\..\..\libs\openFrameworks\events" /I"..\..\..\libs\glut\include" /I"..\..\..\libs\rtAudio\include" /I"..\..\..\libs\quicktime\include" /I"..\..\..\libs\freetype\include" /I"..\..\..\libs\freetype\include\freetype2" /I"..\..\..\libs\freeImage\include" /I"..\..\..\libs\fmodex\include" /I"..\..\..\libs\videoInput\include" /I"..\..\..\libs\glew\include\" /I"..\..\..\libs\glu\include" /I"..\..\..\libs\tess2\include" /I"..\..\..\libs\cairo\include\cairo" /I"..\..\..\libs\poco\include" /I"..\..\..\libs\glfw\include" /I"..\..\..\libs\openssl\include" /I"..\..\..\addons" /I"src" /I"..\..\..\addons\ofxKinectCommonBridge\src" /I"..\..\..\addons\ofxKinectCommonBridge\libs\KinectCommonBridge\include" /I"..\..\..\addons\ofxGui\src" /I"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include" /ZI /Gm /Od /Fd"obj\Debug\vc110.pdb" /fp:precise /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "POCO_STATIC" /D "CAIRO_WIN32_STATIC_BUILD" /D "DISABLE_SOME_FLOATING_POINT" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /Oy- /MDd /Fa"obj\Debug\" /EHsc /nologo /Fo"obj\Debug\" /Fp"obj\Debug\SpeechExample_debug.pch" 

I'm not very familiar with the ATL or it's use but this seems to me that it shouldn't be that difficult to include this file properly. I've dug through both projects and I can't find anything fundamentally different in any of the includes or compiler flags. Thanks for any guidance and I'm happy to provide any more information if it's helpful.

Was it helpful?

Solution

::CreateFile is defined in WinBase.h. So you should #include WinBase.h or Windows.h before you include atlbase.h.

I can't tell for sure why this is not done in atlbase.h itself. But you can define what Windows header files are used in your project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top