0

I've been trying to get the rebound n-body program to work on my PC, which takes some hoop-jumping, and naturally it hasn't worked out to well. I THINK I've gotten freeglut to install properly, but I still get this error when I try to use the make command on any of the examples. Here's the full output I keep getting:

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

I've seen stuff about #ifdef and defines with underscores or numbers following them, but I found no such things in the makefiles in either the example folder or the src folder... I haven't touched the rebound files at all either since obtaining them, so I feel like the problem is either the freeglut installation or in MinGW itself - any ideas? Thanks.

Edit: I've looked around the MakeFile some more and I've pinpointed the problem to one section:

# 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)

Starting at the first line, it gets to the end just fine, but in between there and moving on to the next (the one with problem.c as the target), it breaks - presumably when it tries to compile it. Or, more accurately, when it tries to start to compile it. Before it gets a chance to, something seems to happen to the command line to break it. If I remove $(PREDEF) from the main.c -c line, it will go through that with no errors, and then hit the same error the next time it tries to handle a file prefaced with that $(PREDEF) code. If I remove all the PREDEF code, it seems to start compiling correctly, but more errors come up there, and it may be a direct result of this so I'd like to figure out why it doesn't like $(PREDEF)... I'm sure it's there for a reason.

spacemoose
  • 11
  • 5
  • 1
    Possible duplicate of [:1:1: error: macro names must be identifiers](http://stackoverflow.com/questions/10779872/command-line11-error-macro-names-must-be-identifiers) – phuclv Jan 21 '16 at 12:15

1 Answers1

0

I have solved it - kind of. I could never get it working on MinGW, but after installing cygwin and installing the requisite packages (even though I could have sworn I did so on MinGW as well), I made progress and it stopped giving me this error. It did give me trouble with freeglut though - turns out I hadn't actually managed to solve that in MinGW, so I did some digging there and discovered I needed to use Cygwin's Xterminal instead of just the standard one, and then it found all the OpenGL files just fine.

Long story short, if you run into this problem and you can't find anything in the code at the source, try double checking your installed libraries - I suppose I just wasn't thorough enough.

spacemoose
  • 11
  • 5