Makefile for pthreads

11,261

As it says, there is no example.cpp in the current directory.

Do a ls in the current directory and post here.

Share:
11,261
KateMak
Author by

KateMak

Updated on June 04, 2022

Comments

  • KateMak
    KateMak almost 2 years

    I am trying to compile a pthread example, but am getting the following error:

    make: *** No rule to make target `example.cpp', needed by `example.o'.  Stop.
    

    This is my 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
    

    I included the -pthread flag, I am not sure what else it wants in order to compile. Anyone have any ideas? Thank you very much.