简体   繁体   中英

Why am I getting this error when I run my Makefile?

I am trying to run a makefile to execute my code, but it returns this error:

make: *** [makefile:8: run] Error 127

Makefile code:

main: *.o
    g++ -o main *.cpp

*.o: *.h *.cpp
    g++ -g -c *.cpp

run:
    ./main

clean:
    rm ./*.o main

I believe the problem is that Makefile doesn't like your asterisks. I would recommend leveraging matchers '%' instead.

Please see: How to properly use % or * (asterisk) symbols as a placeholder in makefile?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM