void init(void)
{
glClearColor ((float)0.0, (float)0.0, (float)0.0, (float)0.0);
glShadeModel (GL_FLAT);
}
的参数glClearColor
是浮点数。但是 gcc 总是给出警告:
main.c: In function ‘init’:
main.c:12: warning: passing argument 1 of ‘glClearColor’ as ‘float’ rather than ‘double’ due to prototype
main.c:12: warning: passing argument 2 of ‘glClearColor’ as ‘float’ rather than ‘double’ due to prototype
main.c:12: warning: passing argument 3 of ‘glClearColor’ as ‘float’ rather than ‘double’ due to prototype
main.c:12: warning: passing argument 4 of ‘glClearColor’ as ‘float’ rather than ‘double’ due to prototype
但我只是将一个数字转换为浮点数,而不是双精度数,不知道为什么。
我的操作系统是 mac os 64bit,下面是makefile
.
UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
CFLAG := -framework GLUT -framework OpenGL -g -Wall -Wconversion
else
CFLAG := -lm -lglut -lGL -lGLU -g -Wall
endif
PUB_SRC := util.c plane.c dot.c linked_dots.c controller.c time_data.c
SRC := main.c $(PUB_SRC)
TEST_SRC := test.c $(PUB_SRC)
.PHONY : main
main: $(SRC)
gcc $(CFLAG) $(SRC)
.PHONY : test
test: $(TEST_SRC)
gcc $(CFLAG) $(TEST_SRC)