网上的解释是:“ you need to add -lstdc++, or use 'g++' rather than 'gcc' as your driver program.”,也就是说如果想要使用g++编译程序的话,那么链接时需要添加“-Istdc++”. 我试了一下 , 在链接时加上"-Istdc++",就没有问题了. 关于g++,让我想起了,在ubuntu下一开始安装完code::blocks的时候,提示需要安装g++.原来code::blocks内置编译器使用的是g++,但…
Linux Ubuntu运行线程程序出现undefined reference to ‘pthread_create’和undefined reference to ‘pthread_join’错误. 编写好线程代码,进行编译 gcc xiancheng.c -o xiancheng 出现下面提示 linux@ubuntu64-vm:~/workdir$ gcc xiancheng.c -o xiancheng /tmp/ccOCxLrd.o: In function `main': xianc…
由于是Linux新手,所以现在才开始接触线程编程,照着GUN/Linux编程指南中的一个例子输入编译,结果出现如下错误:undefined reference to 'pthread_create'undefined reference to 'pthread_join' 问题原因: pthread 库不是 Linux 系统默认的库,连接时需要使用静态库 libpthread.a,所以在使用pthread_create()创建线程,以及调用 pthread_atfork()函数建立fork…