我正在尝试编译一个pthread示例,但得到了以下错误:
make: *** No rule to make target `example.cpp', needed by `example.o'. Stop.这是我的makefile:
CC = g++
CCFLAGS = -Wall
example: example.o
$(CC) $(CCFLAGS) -o example example.o -pthread
example.o: example.cpp
$(CC) $(CCFLAGS) -c example.cpp -pthread
clean:
- rm *.o
- rm example我包含了-pthread标志,我不确定它还需要什么才能编译。有谁有什么想法吗?非常感谢。
发布于 2013-04-08 21:06:33
正如它所说的,当前目录中没有example.cpp。
在当前目录中执行ls并在此处发布。
发布于 2013-04-08 17:37:24
查看http://www.cse.iitd.ernet.in/~dheerajb/Pthreads/Document/Pthreads_Information.html它有一个关于pthread makefile http://www.cse.iitd.ernet.in/~dheerajb/Pthreads/codes/C/Makefile.pthread的例子,你需要使用-lpthread
https://stackoverflow.com/questions/15875742
复制相似问题