Cygwin - Makefile-error: recipe for target `main.o' failed

前端 未结 1 1589
礼貌的吻别
礼貌的吻别 2020-12-18 00:25

I am currently failing to write a good makefile and don\'t know the reason why.. -.-

This is my main.c:

#include 
#include 

        
相关标签:
1条回答
  • 2020-12-18 00:43

    You see the two empty -D entries in the g++ command line? They're causing the problem. You must have values in the -D items e.g. -DWIN32

    if you're insistent on using something like -D$(SYSTEM) -D$(ENVIRONMENT) then you can use something like:

    SYSTEM ?= generic
    ENVIRONMENT ?= generic
    

    in the makefile which gives them default values.

    Your output looks to be missing the all important output:

    <command-line>:0:1: error: macro names must be identifiers
    <command-line>:0:1: error: macro names must be identifiers
    

    just to clarify, what actually got sent to g++ was -D -DWindows_NT, i.e. define a preprocessor macro called -DWindows_NT; which is of course not a valid identifier (similarly for -D -I.)

    0 讨论(0)
提交回复
热议问题