[Gdal-dev] Re: Linking the GDAL lib to a Visual C++ 6 project
Mateusz Loskot
mateusz at loskot.net
Tue Mar 6 04:16:44 EST 2007
Arnaud wrote:
> Mateusz Loskot <mateusz <at> loskot.net> writes:
>> Arnaud wrote:
>>> ...
>>> In fact the warning level is set to the highest. This cannot be change.
>>> Do you have any clue what I can do to solve this?
>>
>> Are you using GDAL in MFC-based application?
>>
>
> Yes, I am.
>
> However, I found that there is a problem when I try to include libraries from
> the STL. The trick was to include them like this:
>
> // Include for use of stl
> #pragma warning( push, 3) // Avoid some messages
> #include <string> // STL strings
> #include <iostream> // STL io
> #include <vector>
> #pragma warning( pop ) // Restore warnings
> using namespace std; // Allows std namespace
The problem is that MFC defines 'new' as a preprocessor definition,
when building in debug mode:
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
So, all C++/STL headers should be included *before* any MFC header.
Cheers
--
Mateusz Loskot
http://mateusz.loskot.net
More information about the Gdal-dev
mailing list