make 对‘main’未定义的引用(多线程的可能情况)

linux C/C++ 编程时,出现如下错误提示:

Building target: CTMPServer20160413
Invoking: Cross G++ Linker
g++ -Lcrypto -o "C"  ./lib/adns/check.o ./lib/adns/event.o ./lib/adns/general.o ./lib/adns/parse.o ./lib/adns/poll.o ./lib/adns/query.o ./lib/adns/reply.o ./lib/adns/setup.o ./lib/adns/transmit.o ./lib/adns/types.o   -lpthread
/usr/lib/gcc/x86_64-redhat-linux/5.3.1/../../../../lib64/crt1.o:在函数‘_start’中:
(.text+0x20):对‘main’未定义的引用
collect2: 错误:ld 返回 1
makefile:50: recipe for target 'C20160413' failed
make: *** [C3] Error 1

位置在 此处:

g++ -Lcrypto -o "C"  ./lib/adns/check.o ./lib/adns/event.o ./lib/adns/general.o ./lib/adns/parse.o ./lib/adns/poll.o ./lib/adns/query.o ./lib/adns/reply.o ./lib/adns/setup.o ./lib/adns/transmit.o ./lib/adns/types.o   ***-lpthread***

之前的运行没有问题,到出现-lpthread时出现问题,说明时多线程运行,需要才编译时加入-lpthread参数

g++ -Lcrypto -lpthread -o "C" ...

你可能感兴趣的:(C/C++,linux,make)