首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >pthreads的Makefile

pthreads的Makefile
EN

Stack Overflow用户
提问于 2013-04-08 17:31:33
回答 2查看 11.1K关注 0票数 4

我正在尝试编译一个pthread示例,但得到了以下错误:

代码语言:javascript
复制
make: *** No rule to make target `example.cpp', needed by `example.o'.  Stop.

这是我的makefile:

代码语言:javascript
复制
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标志,我不确定它还需要什么才能编译。有谁有什么想法吗?非常感谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-04-08 21:06:33

正如它所说的,当前目录中没有example.cpp。

在当前目录中执行ls并在此处发布。

票数 6
EN

Stack Overflow用户

发布于 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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15875742

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档