You are not logged in.
Hello,
gcc base.c -o base `pkg-config --cflags --libs gtk+-3.0`
gives error "fatal error: gtk/gtk.h: No such file or directory
#include <gtk/gtk.h>"
Best Regards,
Rasjid
Last edited by chanrasjid (2014-03-13 22:37:01)
Offline
Do you have gtk3 installed?
What is the output of `pacman -Ql gtk3`?
Do you have a /usr/include/gtk-3.0/gtk/gtk.h file?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Hello,
Do you have gtk3 installed?
What is the output of `pacman -Ql gtk3`?
Do you have a /usr/include/gtk-3.0/gtk/gtk.h file?
The ouptut is huge:
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellArea.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellAreaBox.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellAreaContext.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellEditable.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellLayout.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellRenderer.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellRendererAccel.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellRendererCombo.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellRendererPixbuf.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellRendererProgress.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellRendererSpin.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellRendererSpinner.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellRendererText.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellRendererToggle.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCellView.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCheckButton.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkCheckMenuItem.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkColorButton.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkColorChooser.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkColorChooserDialog.html
gtk3 /usr/share/gtk-doc/html/gtk3/GtkColorChooserWidget.ht
...
...
The file '/usr/include/gtk-3.0/gtk/gtk.h' exist.
I compiled in my local home directory '/home/rasjid'
Best Regards,
Chan Rasjid.
Offline
Then your compilation command should work. Can you post the output of `pkg-config --cflags --libs gtk+-3.0`
Also, can you post the actual source file you are trying to compile?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
That's strange... This really should work.
Please post all of the source code that you are trying to compile. (But put it inside [ code ] tags so it's easy to read.)
What is the output of "pkg-config --cflags --libs gtk+-3.0"?
EDIT: Lol @ Trilby. ARE YOU ME??
Last edited by drcouzelis (2014-03-13 19:03:39)
Offline
Hello,
Then your compilation command should work. Can you post the output of `pkg-config --cflags --libs gtk+-3.0`
Also, can you post the actual source file you are trying to compile?
Hello,
Thanks, problem solved. (How do I mark this post solved?)
'pkg-config' was not installed for me; I don't remember there was any GTK+ development package mentioned.
So now 'gcc base.c -o base `pkg-config --libs --cflags gtk+-2.0` works.
But 3.0 does not work, has error:
`pkg-config --libs --cflags gtk+-3.0` - but that's a different problem.
base.c (example from official gnome gtk tutorial site):
#include <gtk/gtk.h>
int main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *label;
gtk_init(&argc, &argv);
/* Create the main, top level window */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
/* Give it the title */
gtk_window_set_title(GTK_WINDOW(window), "Hello, world!");
/*
** Map the destroy signal of the window to gtk_main_quit;
** When the window is about to be destroyed, we get a notification and
** stop the main GTK+ loop by returning 0
*/
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
/*
** Assign the variable "label" to a new GTK label,
** with the text "Hello, world!"
*/
label = gtk_label_new("Hello, world!");
/* Plot the label onto the main window */
gtk_container_add(GTK_CONTAINER(window), label);
/* Make sure that everything, window and label, are visible */
gtk_widget_show_all(window);
/*
** Start the main loop, and do nothing (block) until
** the application is closed
*/
gtk_main();
return 0;
}
Best Regards,
Rasjid
Offline
Thanks, problem solved. (How do I mark this post solved?)
Glad that helped. If you know how to track down the remaining 3.0 issue and consider this solved, you can click "edit" at the bottom right of your first post. This will allow you to edit the title too and prepend the word [SOLVED] to the title.
@ Trilby. ARE YOU ME??
Not quite. I have to flap my wings to fly. I haven't mastered that hovering trick yet!
Last edited by Trilby (2014-03-13 19:53:25)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Just for future reference, always use code tags when posting any terminal output or code snippets:
Not using code tags is the leading cause for people's excommunication from houses of worship world-wide
All the best,
-HG
Offline
chanrasjid wrote:Thanks, problem solved. (How do I mark this post solved?)
Glad that helped. If you know how to track down the remaining 3.0 issue and consider this solved, you can click "edit" at the bottom right of your first post. This will allow you to edit the title too and prepend the word [SOLVED] to the title.
drcouzelis wrote:@ Trilby. ARE YOU ME??
Not quite. I have to flap my wings to fly. I haven't mastered that hovering trick yet!
$ gcc main.c gui.c board.c -export-dynamic `pkg-config --cflags --libs gtk+-3.0` -o gui
error:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libgdk-3.so: undefined reference to `wl_proxy_marshal_constructor'
collect2: error: ld returned 1 exit status
Google search does not give anything relevant. The sources were working quite some times back. But I messed up my archlinux and re-installed everything from scratch. So, somehow, I cannot get a final working 'gui' executable now.
Best Regards,
Rasjid
Offline
No, really. Use code tags.
All the best,
-HG
Offline
Well this is a completely different problem. This is a linker error as you are using wayland functions but have not passed the relevant libs to the linker.
You'll probably be much better off using a Makefile and separating the compiling and the linking - this would make it even more clear at which step the error was.
If you post a link to the actual code we'll be able to actually figure out what is wrong.
You most likely need -lwayland-client for the LDLIBS.
Last edited by Trilby (2014-03-13 21:17:37)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Well this is a completely different problem. This is a linker error as you are using wayland functions but have not passed the relevant libs to the linker.
You'll probably be much better off using a Makefile and separating the compiling and the linking - this would make it even more clear at which step the error was.
If you post a link to the actual code we'll be able to actually figure out what is wrong.
You most likely need -lwayland-client for the LDLIBS.
Thanks, I'll try to figure out later.
Best Regards,
Rasjid.
Offline
Well this is a completely different problem. This is a linker error as you are using wayland functions but have not passed the relevant libs to the linker.
You'll probably be much better off using a Makefile and separating the compiling and the linking - this would make it even more clear at which step the error was.
If you post a link to the actual code we'll be able to actually figure out what is wrong.
You most likely need -lwayland-client for the LDLIBS.
Hello Trilby,
//This gives the same error.
$ gcc -o base base.c `pkg-config --cflags --libs gtk+-3.0`
/* base.c */
#include <gtk/gtk.h>
int main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *label;
gtk_init(&argc, &argv);
/* Create the main, top level window */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
/* Give it the title */
gtk_window_set_title(GTK_WINDOW(window), "Hello, world!");
/*
** Map the destroy signal of the window to gtk_main_quit;
** When the window is about to be destroyed, we get a notification and
** stop the main GTK+ loop by returning 0
*/
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
/*
** Assign the variable "label" to a new GTK label,
** with the text "Hello, world!"
*/
label = gtk_label_new("Hello, world!");
/* Plot the label onto the main window */
gtk_container_add(GTK_CONTAINER(window), label);
/* Make sure that everything, window and label, are visible */
gtk_widget_show_all(window);
/*
** Start the main loop, and do nothing (block) until
** the application is closed
*/
gtk_main();
return 0;
}
Best Regards,
Rasjid
Offline
What do you mean that gives the same error? The same error as in the first post, or the same as the most recent post when there was a wayland issue?
Post the actual error messages.
Also, as you didn't have pkg-config installed, you must not have the base-devel group installed. Install base-devel before trying to go any further.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Hello Trilby,
What do you mean that gives the same error? The same error as in the first post, or the same as the most recent post when there was a wayland issue?
Post the actual error messages.
Also, as you didn't have pkg-config installed, you must not have the base-devel group installed. Install base-devel before trying to go any further.
I re-installed the base-devel group and compiling still gives error:
[rasjid@mycomputer ~]$ gcc -o base base.c `pkg-config --cflags --libs gtk+-3.0`
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libgdk-3.so: undefined reference to `wl_proxy_marshal_constructor'
collect2: error: ld returned 1 exit status
Best Regards,
Rasjid.
Offline
If you want gtk3 with wayland, use this:
pkg-config --cflags --libs gtk+-wayland-3.0
pkg-config --cflags --libs wayland-client # or wayland-egl?
This is a good command to list all configured libraries.
pkg-config --list-all | less
Last edited by progandy (2014-03-13 23:33:49)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Odd, I can compile that hello world program just fine with the gcc command listed here.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Hello,
I have to say I know almost nothing about `pkg-config ...` things; just followed the commands from tutorials.
If you want gtk3 with wayland, use this:
pkg-config --cflags --libs gtk+-wayland-3.0 pkg-config --cflags --libs wayland-client # or wayland-egl?
This is a good command to list all configured libraries.
pkg-config --list-all | less
I have checked that my 'wayland' is installed.
But this fails:
[rasjid@mycomputer ~]$ gcc -o base base.c `pkg-config --cflags --libs wayland-client --libs wayland-egl --libs gtk+-3.0`
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../lib/libgdk-3.so: undefined reference to `wl_proxy_marshal_constructor'
collect2: error: ld returned 1 exit status
Best Regards,
Rasjid
Offline
Odd, I can compile that hello world program just fine with the gcc command listed here.
Then it is indeed odd.
I don't know about compiling with GTK+, but I have used C and Netbeans IDE to write a chess playing program and it is fairly complex and runs. Which means my gcc development packages should be ok. I remember my codes do compile some time way back. Then I took a break, say 6 months, and now coming back to it. But then I reformatted my hard disk and re-installed everthing anew. Now my old codes give this error.
Rasjid.
Offline
I can compile it, too. I am running it in a terminal in xorg/i3. I guess the version of your wayland-package could be too old. I have wayland v1.4.0 and it works.
Something is mentioned here: https://www.redhat.com/archives/anacond … 00021.html
If you don't use wayland functions in your code and don't link directly to it, then it shouldn't be a problem that libgdk-3.so links to libwayland-client.so as long as all packages are up to date.
Last edited by progandy (2014-03-14 03:18:54)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Hello,
I can compile it, too. I am running it in a terminal in xorg/i3. I guess the version of your wayland-package could be too old. I have wayland v1.4.0 and it works.
Something is mentioned here: https://www.redhat.com/archives/anacond … 00021.htmlIf you don't use wayland functions in your code and don't link directly to it, then it shouldn't be a problem that libgdk-3.so links to libwayland-client.so as long as all packages are up to date.
Thanks, SOLVED. I reinstalled wayland.
Best Regards,
Rasjid.
Offline
That still leaves a remaining question. You were missing pkg-config, then later you said you "reinstalled" base-devel. Now "reinstalling" wayland fixed this issue, but wayland is a dependency of gtk3, so certainly it was already installed, right?
How are you "reinstalling" packages? If you are using pacman -Sy <pkg> or any combination of pacman -Sy and pacman -S, you are going to have far more serious problems. Be sure to do regular complete updates (pacman -Syu). I could be wrong here, but partial upgrades are the only explanation I can come up with for this set of symptoms.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
That still leaves a remaining question. You were missing pkg-config, then later you said you "reinstalled" base-devel. Now "reinstalling" wayland fixed this issue, but wayland is a dependency of gtk3, so certainly it was already installed, right?
How are you "reinstalling" packages? If you are using pacman -Sy <pkg> or any combination of pacman -Sy and pacman -S, you are going to have far more serious problems. Be sure to do regular complete updates (pacman -Syu). I could be wrong here, but partial upgrades are the only explanation I can come up with for this set of symptoms.
It is true that I am not following strict practice now and I don't like to, or feel the need to upgrade with -Syyu or whatever. My system is not yet used for real serious thing at present.
I too was surprised that pkg-config was missing in my installation. From google, I think quite a number of people are having this <gtk/gtk.h> error as I did. My fresh installation of Archlinux automatically installed base-devel - I was surprise it is a package name. I just re-installed wayland with 'pacman -Syy' earlier; then 'pacman -S wayland'.
But my current Archlinux is still far far ahead of my nephew's window computer which is 'not usuable' - I had to wait ages before I could start typing commands, etc! just ridiculous.
Rasjid.
Offline
Please read this: Partial upgrades are unsupported
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
... or feel the need to upgrade with -Syyu or whatever. My system is not yet used for real serious thing at present.
If by using your system for "a real serious thing" you mean expecting it to boot up regularly, then you have nothing to worry about. But if you chose to engage in practices that *will* break your system, please include this information in the first post of any future support threads you start.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline