我一直在尝试让反弹 n-body 程序在我的 PC 上运行,这需要一些跳环,自然效果不佳。我认为我已经正确安装了 freeglut,但是当我尝试在任何示例上使用 make 命令时仍然会出现此错误。这是我不断得到的完整输出:
make[1]: Entering directory '/c/rebound-master/src
# Remove old object files
rm -f *.o`
# Compile all source files
cc -O3 -std=c99 -Wpointer-arith -Wno-unknown-pragmas -DOPENGL -D.C -D.C -D.C -D.C main.c -c
"<command line>0:1: error: macro names must be identifiers"
"<command line>0:1: error: macro names must be identifiers"
"<command line>0:1: error: macro names must be identifiers"
"<command line>0:1: error: macro names must be identifiers"
main.c: in function 'main':
main.c:248.9: error: 'SIGKILL' undeclared (first use in this function)
signal(SIGKILL, interruptHandler);
main.c:248.9: note: each undeclared modifier is reported only once for each file it appears in
make[1]: ***[all] Error 1
make[1]: Leaving directory '/c/rebound-master/src'
make: ***[all] Error 2
我已经看到有关#ifdef 的内容并在它们后面定义了下划线或数字,但是我在示例文件夹或 src 文件夹中的 makefile 中都没有发现这样的东西......我也没有接触过反弹文件。获得它们,所以我觉得问题出在 freeglut 安装或 MinGW 本身 - 有什么想法吗?谢谢。
编辑:我又查看了 MakeFile 一些,并将问题定位到一个部分:
# Compile all source files
$(CC) $(OPT) $(PREDEF) main.c -c
$(CC) $(OPT) $(PREDEF) problem.c -c
$(CC) $(OPT) $(PREDEF) tree.c -c
$(CC) $(OPT) $(PREDEF) particle.c -c
$(CC) $(OPT) $(PREDEF) gravity.c -c
$(CC) $(OPT) $(PREDEF) integrator.c -c
$(CC) $(OPT) $(PREDEF) boundaries.c -c
$(CC) $(OPT) $(PREDEF) input.c -c
$(CC) $(OPT) $(PREDEF) output.c -c
$(CC) $(OPT) $(PREDEF) collisions.c -c
$(CC) $(OPT) $(PREDEF) collision_resolve.c -c
$(CC) $(OPT) $(PREDEF) communication_mpi.c -c
$(CC) $(OPT) $(PREDEF) zpr.c -c
$(CC) $(OPT) $(PREDEF) display.c -c
$(CC) $(OPT) $(PREDEF) tools.c -c
$(CC) *.o -o nbody $(LIB)
从第一行开始,它一直到最后都很好,但是在中间到下一行(以 problem.c 为目标的行),它中断了 - 大概是在它尝试编译它时。或者,更准确地说,当它试图开始编译它时。在它有机会之前,命令行似乎发生了一些事情来破坏它。如果我从 main.c -c 行中删除 $(PREDEF) ,它将顺利通过,然后在下次尝试处理以该 $(PREDEF) 代码开头的文件时遇到相同的错误。如果我删除所有 PREDEF 代码,它似乎开始正确编译,但出现更多错误,这可能是直接结果,所以我想弄清楚为什么它不喜欢 $(PREDEF)。 ..我确定它的存在是有原因的。