You are not logged in.

#1 2009-08-28 19:34:37

markg85
Member
Registered: 2009-06-27
Posts: 149

Codeblock gives errors where the console g++ just works

Hi,

This is the code i'm trying to test (just a testcase. the actual code is more complex and a lot bigger and doesn't even open a window)

#include <gtk/gtk.h>

int
main (int argc, char **argv)
{
    gtk_init (&argc, &argv);
    GtkWidget *win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_show_all (win);
    gtk_main ();
    return 0;
}

Now if i compile that code with this on the command line: g++ `pkg-config --cflags --libs gtk+-2.0` test.cpp -o test
It will compile just fine and will run just fine. But now the most annoying and frustrating thing is codeblocks.. that somehow manages to throw in the following errors:

test.cpp|6|undefined reference to `gtk_init'|
test.cpp|7|undefined reference to `gtk_window_new'|
test.cpp|8|undefined reference to `gtk_widget_show_all'|
test.cpp|9|undefined reference to `gtk_main'|
||=== Build finished: 4 errors, 0 warnings ===|

And in the build options i have:
(under all builds like debug and release)
Linker settings
'pkg-config gtk+-2.0 --libs --cflags'

O btw. this all used to work just fine in ubunto and the fact that it works fine when i manually compile it clearly tells me that:
- All packages are installed
- pkg-config is working
- codeblocks is not working

Any ideas where this could go wrong in codeblocks?
And any ideas how to fix it?

O btw. i have this undefined error with every single function that comes from a included file.

Offline

#2 2009-08-29 00:30:24

markg85
Member
Registered: 2009-06-27
Posts: 149

Re: Codeblock gives errors where the console g++ just works

never mind this issue. this one is fixed.
Don't bother asking me why because i did a few things then it just worked.. one includes upgrading codeblocks to the latest revision with the aur codeblocks pkgbuild file.

Offline

#3 2009-08-29 04:25:18

djszapi
Member
From: Cambridge, United Kingdom
Registered: 2009-06-14
Posts: 1,439
Website

Re: Codeblock gives errors where the console g++ just works

Hello Markg85!

Great! You can sign the topic with 'Solved'!

Offline

Board footer

Powered by FluxBB