I am using the Copter 3.4.3 source code. I am able to compile the copter firmware (for firmware) using the pixhawk toolchain, both with make and eclipse. However, I am unable to build sitl. The error is as follows
cc1plus.exe: error: unrecognized command line option ‘-std=gnu++11’
Any ideas? Thanks in advance
What compiler are you using to compile on Windows?
Sorry for the long wait, holiday season and all.
Unfortunately I will not have access to the machine I was using until January 1st. But I was trying to build using the latest version of the pixhawk toolchain, which came with a version of GCC. I cannot verify the exact version of GCC right now, but since it was supplied in the toolchain I assumed It should work as it is?
SITL isn’t compiled with the compiler of the toolchain, it needs a native compiler, not a cross-compilation one like the one in the toolchain is.
Ah, that would explain why I could compile the Copter firmware without any problem but not the SITL. How would you suggest I proceed then?
You need to figure out what compiler you are using and probably you need to update it.
Sorry for the long inactivity period, as I said I did not have access to the machine I was using until today.
I have since updated the GCC version, so I am now using GCC 5.3.0. The error I mentioned above (not recognizing ‘-std=gnu++11’) is gone. However, I am still unable to build sitl, with new error regarding undeclared methods showing up. More specifically, it cannot find the strtok_r and the isnan methods.
I have done some quick digging and found some answers, regarding this, but they simply suggest adding the mission methods to the source code. Apparently these methods are not defined in mingw.
Although I can certainly do that, I’d prefer not to (might be some work, since I don’t know in how many files they are used, and I’d rather be sure I am using the correct method instead of copying some code from other source). Is there other fix around this issue?
Fixed: built using Cygwin instead of the mingw supplied with the toolchain
Interesting that mingw doesn’t have those methods. The Pixhawk toolchain was made exactly for that, compiling for the Pixhawk, so I’m not surprised that it doesn’t work for SITL. I think everyone compiling SITL in Windows does it with Cygwin instead of trying natively.