C++ 多线程

https://www.runoob.com/cplusplus/cpp-multithreading.html

g++ test.cpp -lpthread -o test.o
g++ -pthread cpp11Thread0525.cpp -o cpp11Thread0525.o

编译:make obj-intel64/funcTrace.so TARGET=intel64
运行:./pin -t source/tools/ManualExamples/obj-intel64/funcTrace.so – /home/lu/software_new/mysql/bin/mysqld --user=root --datadir=/home/lu/software_new/mysql/data

g++ -Wall -Werror -Wno-unknown-pragmas -D__PIN__=1 -DPIN_CRT=1 -fno-stack-protector -fno-exceptions -funwind-tables -fasynchronous-unwind-tables -fno-rtti -DTARGET_IA32E -DHOST_IA32E -fPIC -DTARGET_LINUX -fabi-version=2 -I…/…/…/source/include/pin -I…/…/…/source/include/pin/gen -isystem /home/lu/new10g/sda3/pintool/pin-3.6-97554-g31f0a167d-gcc-linux/extras/stlport/include -isystem /home/lu/new10g/sda3/pintool/pin-3.6-97554-g31f0a167d-gcc-linux/extras/libstdc++/include -isystem /home/lu/new10g/sda3/pintool/pin-3.6-97554-g31f0a167d-gcc-linux/extras/crt/include -isystem /home/lu/new10g/sda3/pintool/pin-3.6-97554-g31f0a167d-gcc-linux/extras/crt/include/arch-x86_64 -isystem /home/lu/new10g/sda3/pintool/pin-3.6-97554-g31f0a167d-gcc-linux/extras/crt/include/kernel/uapi -isystem /home/lu/new10g/sda3/pintool/pin-3.6-97554-g31f0a167d-gcc-linux/extras/crt/include/kernel/uapi/asm-x86 -I…/…/…/extras/components/include -I…/…/…/extras/xed-intel64/include/xed -I…/…/…/source/tools/InstLib -O3 -fomit-frame-pointer -fno-strict-aliasing -c -o obj-intel64/cpp11Threads.o cpp11Threads.cpp
g++ -shared -Wl,–hash-style=sysv …/…/…/intel64/runtime/pincrt/crtbeginS.o -Wl,-Bsymbolic -Wl,–version-script=…/…/…/source/include/pin/pintool.ver -fabi-version=2 -o obj-intel64/cpp11Threads.so obj-intel64/cpp11Threads.o -L…/…/…/intel64/runtime/pincrt -L…/…/…/intel64/lib -L…/…/…/intel64/lib-ext -L…/…/…/extras/xed-intel64/lib -lpin -lxed …/…/…/intel64/runtime/pincrt/crtendS.o -lpin3dwarf -ldl-dynamic -nostdlib -lstlport-dynamic -lm-dynamic -lc-dynamic -lunwind-dynamic -lpthread

我在ubuntu16.04上迁移工程,遇到了这个错误。

pthread库不是Linux系统默认的库,链接时需要添加-pthread参数。

这里注意是链接那一步添加-pthread,而不是编译选项。
https://www.cnblogs.com/badboy200800/p/9956088.html

ubuntu 下没有pthread库以及报undefined reference to 'pthread_create’的解决方法
https://blog.csdn.net/xueyushenzhou/article/details/51206351 /etc/ld.so.conf.d

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值