How to recognise add-on libraries using Code::Blocks?

Suppose I want to make a GTK+ GUI application. Its source code is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <gtk/gtk.h>

int main( int argc, char *argv[])
{
  GtkWidget *window;

  gtk_init(&argc, &argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_widget_show(window);

  gtk_main();

  return 0;
}


First I download the GTK+ graphics library. I did this.

Ofcoarse if I just compile this as is, codeblocks will give an error saying:
"gtk/gtk/h: No such file or directory"

Thats because I never told the IDE to look for that downloaded library.

Ultimately:
How do I tell the IDE to look for the library on my computer?
Last edited on
You can add additional paths in Project/Build options/Search Directories.
In the compiler tab you add the include folders and in the linker tab you add the actual library directories.
In linker settings/link libraries you'll have to add the names of the libraries you want to link against.
Note that if you're using a Linux distro, you should use the package manager to install the development version of the GTK+ library, which will install all required header files and libraries in places where the compiler will find them.
Sorry Athar, but youre not specific enough.

I would appreciate an exact step by step process. Because I tried what you suggested and codeblocks doesnt allow me to open "build options". Even when I select a GTK project it doesnt work.
Still no luck, I tried all options in codeblocks
The Project has to be open for you to able to use "build options".
Shit now I cant even compile simple code nevermind GUI. Ive just switched from Dev C++. When I compile a project it says:

"A - Release" uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! Skipping...
Nothing to be done.
Topic archived. No new replies allowed.