pthreads的Makefile

Kat*_*Mak 2 c c++ linux makefile pthreads

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

make: *** No rule to make target `example.cpp', needed by `example.o'.  Stop.
Run Code Online (Sandbox Code Playgroud)

这是我的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
Run Code Online (Sandbox Code Playgroud)

我包含了-pthread标志,我不确定它还需要什么才能编译.有人有主意吗?非常感谢你.

Zif*_*ion 5

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

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