ARTHUR
ARTHUR

Reputation: 19

Customize compiler command in C++ IDEs

Is it possible to customize or specify the command for compiling in codeblocks or any of the other IDEs like NetBeans and Eclipse C++?

I'm asking this because I tried all those IDEs and no one can find the libraries even though it's there listed in the code assistance list (NetBeans 7.2). However, when I compile it in shell in Ubuntu 12.04 LTS, the libraries are located and the program can be compiled.

I use one of the commands:

gcc -lGL -lglut filetoCompile.cpp -o compiled.sh
g++ -lGL -lglut filetoCompile.cpp -o compiled.sh

to compile. I'm trying to use glut for open GL stuff and this is the library it can't find. I assume it may be the same for other third party libraries I may add in the future that's why I really need to get this fixed that's why my plan is to have the IDE use that command instead because it might work.

What's also odd is that my /usr/local/lib directory only contains 2 folders: python 2.7 and python 3.2. I'm not sure if this has an effect but is this normal? Shouldn't the libraries somehow be found here and the headers are in /usr/local/include?

The header files are located in /usr/include. Is this the correct location?

Upvotes: 0

Views: 108

Answers (1)

JohnTortugo
JohnTortugo

Reputation: 6625

Generally speaking, yes this is possible.

In Eclipse CDT, you can set the directory where the header files are in this window:

Right click on project name; Properties; C/C++ General; Paths and symbols; Includes;

In window you must add all directories that contain header files for the functions/classes you want auto completion for. For example, my configuration is:

/usr/include/c++/4.4.5
/usr/local/include
/usr/lib/gcc/i486-linux-gnu/4.4.5/include

to find which folder contain an header file you can use the find or locate command, and set the IDE properly.

Upvotes: 0

Related Questions