Quote Originally Posted by ninja9578 View Post
That's because your syntax isn't quite right. Try this:

Code:
obj_files/AP_commons.o: AP_commons.cpp
   g++ AP_commons.cpp -g -O2 -Wall -MT obj_files/AP_commons.o -MD -MP -MF
"./obj_files/AP_commons.Tpo" -c
You can't specify where to compile to in the compile line itself, instead you tell it what output file the compile line belongs to.

The syntax for compiling only goes:
Code:
Target: All dependancies (including libraries)
   compiler command
That one didn't work either g++ thought the *.0 and *.Tp0 were the input files and said it couldn't find them.

I noticed that I couldn't find any place where it actually used the *.Tpo files, so I experimented this morning with a very simple command line of
g++ AP_commons.cpp -c
then moving the *.o files to obj_files manually. That cured most of the problems.

But then I discovered that g++ couldn't find lroundf in the math library, even though it's there just as much as the other math functions the code uses. Fortunately it was simple to replace lroundf with the expression of (int)(n+0.5)

After that, g++ couldn't find the system getopt.h, even though it's just as much there as any of the other system inlcudes. So I had to specify the absolute file location in the source code.

But now, the g++ linking stage can't find getopt_long in getopt.h, even though it is there. And I have no idea how to fix that