[Gdal-dev] Re: Linking the GDAL lib to a Visual C++ 6 project

Arnaud beaudele at yahoo.fr
Tue Mar 6 03:30:43 EST 2007


Mateusz Loskot <mateusz <at> loskot.net> writes:

> 
> Arnaud wrote:
> > Hello,
> > 
> > I imported the GDAL lib to a vc6 project. I just want to import many DEM 
files 
> > in order to be able to get the altitude of any point on the earth.
> > But whenever I try to include the gdal_priv.h file, I get several errors:
> > 
> > <<my project directory>>\gdal\include\cpl_string.h(218) : error C2220: 
warning 
> > treated as error - no object file generated
> > <<my project directory>>\gdal\include\cpl_string.h(218) : warning C4097: 
> > typedef-name 'string' used as synonym for class-
name 'basic_string<char,struct 
> > std::char_traits<char>,class std::allocator<char> >'
> > <<my project directory>>\gdal\include\cpl_string.h(219) : warning C4097: 
> > typedef-name 'string' used as synonym for class-
name 'basic_string<char,struct 
> > std::char_traits<char>,class std::allocator<char> >'
> > c:\program files\microsoft visual studio\vc98\include\memory(16) : error 
> > C2059: syntax error : 'string'
> > c:\program files\microsoft visual studio\vc98\include\memory(17) : error 
> > C2091: function returns function
> > c:\program files\microsoft visual studio\vc98\include\memory(17) : error 
> > C2809: 'operator new' has no formal parameters
> > c:\program files\microsoft visual studio\vc98\include\memory(20) : error 
> > C2954: template definitions cannot nest
> > c:\program files\microsoft visual studio\vc98\include\vector(249) : 
warning 
> > C4663: C++ language change: to explicitly specialize class 
template 'vector' 
> > use the following syntax:
> >         template<> class vector<bool,class std::allocator<unsigned int> 
> ...
> > 
> > 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?
> 
> Cheers

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

And problem solved...
Thanks anyway. Cheers.






More information about the Gdal-dev mailing list