|
仅仅写了一个hello.cpp:
#include<string>
int main(){
string hello ;
return 0 ;
}
运行g++ -o hello.o hello.cpp
出现错误如下:
hello.cpp: In function `int main()':
hello.cpp:4: error: `string' undeclared (first use this function)
hello.cpp:4: error: (Each undeclared identifier is reported only once for each
function it appears in.)
hello.cpp:4: error: syntax error before `=' token
我打g++ -print-search-dirs显示"Display the directories in the compiler's search path"
出来好多库:
install: /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/
programs: =/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/:/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/:/usr/lib/gcc-lib/i386-redhat-linux/:/usr/lib/gcc/i386-redhat-linux/3.3.2/:/usr/lib/gcc/i386-redhat-linux/:/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../../../i386-redhat-linux/bin/i386-redhat-linux/3.3.2/:/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../../../i386-redhat-linux/bin/
libraries: =/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/:/usr/lib/gcc/i386-redhat-linux/3.3.2/:/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../../../i386-redhat-linux/lib/i386-redhat-linux/3.3.2/:/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../../../i386-redhat-linux/lib/:/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../../i386-redhat-linux/3.3.2/:/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../../:/lib/i386-redhat-linux/3.3.2/:/lib/:/usr/lib/i386-redhat-linux/3.3.2/:/usr/lib/
也就是说找不到c++的库...
我的系统是fedora
请高手指教,多谢!!!
:help :help :help |
|