新人请问LINUX下使用hash_map遇到的编译有关问题
新人请教LINUX下使用hash_map遇到的编译问题
//main.c
//HashMapTemp.h
在使用g++编译的时候,能正确的找到这个hash_map头文件,但是却出一个莫名其妙的错误,,不不知道咋解决,错误提示如下:
/usr/include/machine/stdlib.h:14: error: expected init-declarator before "extern"
/usr/include/machine/stdlib.h:14: error: expected `,' or `;' before "extern"
<builtin>: recipe for target `test.o' failed
make: *** [test.o] Error 1
求帮忙看一下。
------解决方案--------------------
一般都是程序中少加了个";"导致错误原因并没有定位在正确的代码上
//main.c
- C/C++ code
#include "HashMapTemp.h" int main(void) { return 0; }
//HashMapTemp.h
- C/C++ code
#ifndef __HASH_MAP_TEMP_H__ #define __HASH_MAP_TEMP_H__ #ifdef WIN32 #include <hash_map> using namespace std; using namespace stdext; #else #include <ext/hash_map> using namespace __gnu_cxx; #endif template<typename Key, typename Value> class CHashMapTemp { public: CHashMapTemp() { // } }; #endif
在使用g++编译的时候,能正确的找到这个hash_map头文件,但是却出一个莫名其妙的错误,,不不知道咋解决,错误提示如下:
/usr/include/machine/stdlib.h:14: error: expected init-declarator before "extern"
/usr/include/machine/stdlib.h:14: error: expected `,' or `;' before "extern"
<builtin>: recipe for target `test.o' failed
make: *** [test.o] Error 1
求帮忙看一下。
------解决方案--------------------
一般都是程序中少加了个";"导致错误原因并没有定位在正确的代码上