奇怪的GDAL错误用于编译

时间:2014-05-19 19:49:23

标签: c++ compilation makefile gdal

所以我认为我使用aptitude正确安装了GDAL,而我的所有makefile都是 `g ++ main.cpp -I / usr / include / mysql -lmysqlclient -I / usr / include / gdal -lgdal1.7.0'

但我在制作时遇到了这个错误" ubuntu vm"

`g++ main.cpp -I/usr/include/mysql -lmysqlclient   -I/usr/include/gdal -lgdal1.7.0
In file included from /usr/include/c++/4.6/vector:65:0,
             from /usr/include/gdal/gdal_priv.h:58,
             from main.cpp:5:
/usr/include/c++/4.6/bits/stl_vector.h: In member function ‘std::vector<_Tp,        _Alloc>::size_type std::vector<_Tp, _Alloc>::_M_check_len(std::vector<_Tp,   _Alloc>::size_type, const char*) const’:
/usr/include/c++/4.6/bits/stl_vector.h:1244:40: error: expected unqualified-id before ‘(’ token
In file included from /usr/include/c++/4.6/vector:66:0,
             from /usr/include/gdal/gdal_priv.h:58,
             from main.cpp:5:
 /usr/include/c++/4.6/bits/stl_bvector.h: In member function ‘std::vector<bool, _Alloc>::size_type std::vector<bool, _Alloc>::_M_check_len(std::vector<bool, _Alloc>::size_type, const char*) const’:
 /usr/include/c++/4.6/bits/stl_bvector.h:1026:45: error: expected unqualified-id before ‘(’ token
make: *** [all] Error 1

`

不知道如何解决这个问题 这是我的所有代码:

#include <iostream>
#include "sql.h"
#include "gdal_priv.h"
#include "cpl_conv.h"
int main(int argc, char ** argv){
   GDALDataset  *poDataset;
   return 0;
}

1 个答案:

答案 0 :(得分:0)

这看起来更像是STL /向量问题,而不是GDAL特定问题。当gdal_priv.h执行

时出现问题
#include <vector>

我首先检查一下你是否可以编译这样的东西:

#include <vector>

int main(int argc, char ** argv){
   std::vector<int> foo;
}