User forums > General (but related to Code::Blocks)
How to GTK+2.0 in CentOS 5
(1/1)
cOde1:
Hello,
I've installed gtk+2.0 in CentOS 5.
I can compie program from command prompt using gtk+ but don't know how to do it in Codeblocks.
After searching some threads I've added these codes into Codeblock's Settings > Compiler and Debugger settings > Other options
--- Code: ---`pkg-config --libs --cflags gtk+-2.0`
--- End code ---
and tried to compile a simple file which is compilable in terminal:
--- Code: ---#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;
}
--- End code ---
It gives error message:
--- Quote ---/home/cOde1/Documents/gtk+/programs/window.o||In function `main':|
window.c|| undefined reference to `gtk_init'|
window.c|| undefined reference to `gtk_window_new'|
window.c|| undefined reference to `gtk_widget_show'|
window.c|| undefined reference to `gtk_main'|
||=== Build finished: 4 errors, 0 warnings ===|
--- End quote ---
Any help please.
Thanks.
Edit:
-------
Compiler is gcc:
--- Code: ---$ rpm -q gcc
gcc-4.1.2-52.el5_8.1
--- End code ---
oBFusCATed:
--- Quote from: cOde1 on September 19, 2012, 08:49:58 pm ---After searching some threads I've added these codes into Codeblock's Settings > Compiler and Debugger settings > Other options
--- Code: ---`pkg-config --libs --cflags gtk+-2.0`
--- End code ---
--- End quote ---
Definitely the wrong place.
Try to put `pkg-config --cflags gtk+-2.0`in Project -> Build options -> Compiler -> Other options
and `pkg-config --libs gtk+-2.0`in Project -> Build options -> Linker -> Other linker options
Jenna:
Don't use global compiler settings, if it is not absolutely necessary.
Better use the project settings.
Put `pkg-config --cflags gtk+-2.0` in the compilers other options and `pkg-config --libs gtk+-2.0` in the linkers other options.
cOde1:
Hello,
I've removed that line from "global compiler" settings & added those in project's "build option" settings. Now, it's compiling files.
Thanks for the solution. :)
Navigation
[0] Message Index
Go to full version