Author Topic: Project -> Build options v. Build -> Compiler options (aka Compiler Settings)  (Read 4237 times)

Offline xnhcoder

  • Single posting newcomer
  • *
  • Posts: 9
  • Okay, but I'm dancing on the inside.
I'm making the change from Dev-C++ to C::B, so I'm on still on the wrong side of the learning curve, and I have a couple of questions about how C::B does things.

1. At Build -> Compiler options (aka Compiler settings), I can specify the default settings for each compiler I want to use.  In the Project's Build Options, the entries I make at the "Compiler," "Linker," "Directories" tabs override the default settings made at Compiler options, but only for that project.  Is this correct?

2.  I'm a little confused about "Link libraries" and "Other link settings" on the Linker tab for both Compiler options and Build options.  In Dev-C++ (as I recall), if I want to link to, say, the Foo static library (\foolib\libfoo.a), I would add the linker flag -lfoo and specify \foolib under the "Directories" tab.  How do I do this in C::B?  It seems that C::B wants me to specify the full path to libfoo.a in the "Link libraries."  But, if so, what do I do about "Other link settings" and the "Directories"->"Linker" tab?  If I specify the library files (with full path) under "Link libraries," does C::B automatically add the appropriate -l linker flag?

Thanks for the info.


Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
1. Yes

2. Under "link libraries", add the libraries you want to link with, and under "other linker options", enter whatever commandline options you wish to pass to the linker in addition. If you don't know what to do with it, just forget that field, you don't necessarily need it.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline xnhcoder

  • Single posting newcomer
  • *
  • Posts: 9
  • Okay, but I'm dancing on the inside.
Thanks for your prompt response. 

2.  So may I just forget about "link libraries" and, instead, specify libraries with "-l" options under "other linker options" and paths to libraries under "Directories"?  This latter approach makes sense to me and (I think) is the way Dev-C++ does it.

Also, BTW, how do I view the command that C::B uses when it "invokes compiler directly" or the makefile when that I select that Build method under the "Other" tab?

Thanks again.

Offline yop

  • Regular
  • ***
  • Posts: 387
Settings->Compiler->Other->Advanced Options
Life would be so much easier if we could just look at the source code.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
2.  So may I just forget about "link libraries" and, instead, specify libraries with "-l" options under "other linker options" and paths to libraries under "Directories"?  This latter approach makes sense to me and (I think) is the way Dev-C++ does it.
Whatever makes sense to you:

-lfoo in the right field is the same as entering foo in the left field (or entering /bar/lib/libfoo.a).
You can let the IDE do the dirty work or you can write out everything explicitely - as you like.

The right box is handy when you need to pass other options to the linker, too (if you want non-standard images, or a different imagebase, or some special section alignment, optimization, etc). If you don't need such stuff, just use the left box, because it is a lot more comfortable.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline xnhcoder

  • Single posting newcomer
  • *
  • Posts: 9
  • Okay, but I'm dancing on the inside.
Thanks for the good info and advice.  See also my "Troubleshooting" post "Specifying order of GLUI - GLUT - OpenGL libraries" for a reason to choose the explicit approach rather than the implicit.