简体   繁体   English

Makefile编译错误不适用-std = c99

[英]Makefile compile error not applying -std=c99

I have been given supposedly working code that I just need to modify, however I can't actually compile the program with the supplied makefile given below. 据说我已经得到需要修改的工作代码,但是我实际上不能使用下面提供的makefile编译程序。

INCLUDE_PATH = -I/usr/X11/include -I$(BLDR_FREEGLUT_INCLUDE_PATH)
LIBRARY_PATH = -L/usr/X11/lib -L$(BLDR_FREEGLUT_LIB_PATH)
CCFLAGS = -std=c99 
LDFLAGS = -lGL -lGLU -lglut -lX11 -lpthread

GCC = gcc
APP = nbody

all: $(APP)
    @echo Make done

clean:
    @rm -f *.o $(APP)

nbody: nbody.c
    $(GCC) nbody.c -o nbody $(INCLUDE_PATH) $(CCFLAGS) $(LIBRARY_PATH) $(LDFLAGS)

The first output line of the make command gives below. make命令的第一行输出如下。

gcc nbody.c -o nbody -I/usr/X11/include -I -std=c99  -L/usr/X11/lib -L -lGL -lGLU -lglut -lX11 -lpthread

However below that are errors saying that certain things are only "allowed in C99 mode", which I don't understand since the flag for c99 seems to be specified correctly. 但是下面有一些错误,指出某些事情仅在“ C99模式下允许”,我不明白,因为c99的标志似乎已正确指定。 To troubleshoot this I have tried changing the location of the $(CCFLAGS) value without any success. 为了解决这个问题,我尝试更改$(CCFLAGS)值的位置,但没有成功。

How can I modify this makefile so the program complies? 如何修改此makefile,使程序符合要求?

-I -std=c99 says compiler to add directory named -std=c99 to include search paths. -I -std=c99表示编译器添加名为-std=c99目录以包含搜索路径。 This is not what you wanted. 这不是您想要的。 Judging by presented fragment, $(BLDR_FREEGLUT_INCLUDE_PATH) is empty - while it shouldn't be. 从显示的片段来看, $(BLDR_FREEGLUT_INCLUDE_PATH)为空-不应为空。 Fix that variable's value and things will go well. 修正该变量的值,一切将会顺利进行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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