我試圖編譯在Ubuntu使用地圖功能的Ubuntu
#include <unordered_map.h>
typedef unsigned int key_type; // fine, has < , ==, and std::hash
typedef std::map<key_type, some_value_type> my_map;
下面的代碼使用此命令
g++ -Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -DUNIV_LINUX -DUNIV_LINUX -I/usr/include/ -I/usr/include/c++/4.5/bits/ main.c -o program
,我得到這個錯誤
[email protected](none:/usr/local/src/testing$ make
g++ -Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -DUNIV_LINUX -DUNIV_LINUX -I/usr/include/ -I/usr/include/c++/4.5/bits/ main.c -o program
In file included from main.c:5:0:
/usr/include/c++/4.5/bits/unordered_map.h:33:32: error: expected constructor, destructor, or type conversion before ‘(’ token
make: *** [all] Error 1
這裏是一個定位map.h
1234 @(none):/ usr/local/src目錄/測試$定位map.h
/usr/include/c++/4.5/bits/stl_map.h
/usr/include/c++/4.5/bits/stl_multimap.h
/usr/include/c++/4.5/bits/unordered_map.h
/usr/include/c++/4.5/debug/map.h
/usr/include/c++/4.5/debug/multimap。 h
/usr/include/c++/4.5/profile/map.h
/usr/include/c++/4.5/profile/multimap.h
/usr/include/c++/4.5/profile/impl/profiler_map_to_unordered_map.h
/usr/include/c++/4.5 /tr1/unordered_map.h
此外,我還有其他studd在那裏的MySQL,我將使用,但主要只是返回0;
你想使用'map'或'unordered_map'嗎? – robert
爲什麼你包含unordered_map但聲明瞭一種地圖? –