User forums > Help
Adding compiler/linker flags to the end
(1/1)
backes:
Hello,
I'm using Code::Blocks 16.01 on Fedora. I need to link Eigen and MathGL. The makefile would look like:
--- Code: ---g++ -std=gnu++11 -o3 -march=native -I /usr/include/ -I /usr/include/eigen3/ -c ... -o ... -lmgl
--- End code ---
After a bit of searching the web I was able to setup the compiler in code::blocks to have all the includes and flags I want. The only missing part is the -lmgl flag. When I add it under "Compiler Settings" -> "Other Compiler Options" it gets added right after the g++ (e.g. g++ -myflag -std=gnu++11 ...) When I add it in "Linker settings" -> "Other linker options" it doesn't appear at all in the build log and the program won't compile.
Is there a way to add this -lmgl linker flag at the end of the build command or do I have to use make?
Thank you,
backes
/edit: And the security question for the forum is wrong as we're already 2018
stahta01:
Did you try adding mgl to the library list under the "Linker settings"?
If that fails, post a build log of the failure.
http://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
Tim S.
backes:
Hello,
Thank you for your reply. I had another look at the Build log and saw that one error suggested to use gnu++11. As I set the -std=c++11 flag already and thought they were equivalent I assumed that the problem was in the missing -lmgl flag. I just found out, that c++11 and gnu++11 are in fact not the same, and the problem got resolved with the gnu++11 flag (instead of c++11). Now the second line in the build log includes the -lmgl flag and everything is compiling and linking flawlessly.
As a side note, I can't add mathgl to the library list because it's not a compiled library but consists only of header files. Giving the compiler the search path works.
Thank you,
backes
Navigation
[0] Message Index
Go to full version