LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 06-23-2010, 04:44 PM   #1
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Blog Entries: 62

Rep: Reputation: 54
C inclusion problem


When I go to #include vital GTK header files this way:

Code:
#include <glib.h>
#include <glib/gtypes.h>
#include <gtk/gtk.h>
I get the dreaded "No such file or directory" error, even *WITH* the files installed. Why? Are there any variables I have to set or something?
 
Old 06-23-2010, 05:18 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,123

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
Quote:
Originally Posted by Kenny_Strawn View Post
When I go to #include vital GTK header files this way:

Code:
#include <glib.h>
#include <glib/gtypes.h>
#include <gtk/gtk.h>
I get the dreaded "No such file or directory" error, even *WITH* the files installed. Why? Are there any variables I have to set or something?
Enter

setting gcc include paths

into Yahoo and read the very first match.
 
Old 06-23-2010, 05:19 PM   #3
ForzaItalia2006
Member
 
Registered: Dec 2009
Location: Walldorf, Germany
Distribution: (X)Ubuntu, Arch, Gentoo
Posts: 205

Rep: Reputation: 67
Quote:
Originally Posted by Kenny_Strawn View Post
When I go to #include vital GTK header files this way:

Code:
#include <glib.h>
#include <glib/gtypes.h>
#include <gtk/gtk.h>
I get the dreaded "No such file or directory" error, even *WITH* the files installed. Why? Are there any variables I have to set or something?
I don't know which system you're using and I don't know which version of GTK you're using, but you could try to include this one (or similar) into your compilation:

pkg-config --cflags --libs gtk+-2.0

For example:

Code:
gcc <whatever> `pkg-config --cflags --libs gtk+-2.0`
BUT, you should also find this in a _good_ GTK tutorial for Linux :-)

Andi
 
1 members found this post helpful.
Old 06-23-2010, 08:01 PM   #4
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Blog Entries: 62

Original Poster
Rep: Reputation: 54
Quote:
Originally Posted by ForzaItalia2006 View Post
I don't know which system you're using and I don't know which version of GTK you're using, but you could try to include this one (or similar) into your compilation:

pkg-config --cflags --libs gtk+-2.0

For example:

Code:
gcc <whatever> `pkg-config --cflags --libs gtk+-2.0`
BUT, you should also find this in a _good_ GTK tutorial for Linux :-)

Andi
I'm using Ubuntu 10.10 Alpha 1 with GNOME 2.31, and that post really helped me. Thank you. So much for Sergei Stashenko's blunt comment telling me to go take a hike.
 
Old 06-23-2010, 08:17 PM   #5
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,123

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
Quote:
Originally Posted by Kenny_Strawn View Post
I'm using Ubuntu 10.10 Alpha 1 with GNOME 2.31, and that post really helped me. Thank you. So much for Sergei Stashenko's blunt comment telling me to go take a hike.
Do you understand the mechanism behind

Code:
gcc <whatever> `pkg-config --cflags --libs gtk+-2.0`
?

I.e. I suggested you to study the fundamental issues, and ForzaItalia2006 gave you a particular command line which, of course, in the end uses the fundamental features you are supposed to know. Unless you know/understand the fundamental issues, you are destined to face similar problems in the future.

By the way, read about 'pkg-config' - to know why/what for it was invented. Its existence is due to a bunch of similar fundamental issues involved is SW development.
 
Old 06-24-2010, 02:29 AM   #6
ForzaItalia2006
Member
 
Registered: Dec 2009
Location: Walldorf, Germany
Distribution: (X)Ubuntu, Arch, Gentoo
Posts: 205

Rep: Reputation: 67
Quote:
Originally Posted by Sergei Steshenko View Post
Do you understand the mechanism behind

Code:
gcc <whatever> `pkg-config --cflags --libs gtk+-2.0`
?

I.e. I suggested you to study the fundamental issues, and ForzaItalia2006 gave you a particular command line which, of course, in the end uses the fundamental features you are supposed to know. Unless you know/understand the fundamental issues, you are destined to face similar problems in the future.
Yes, you're generally right and it is always beneficial to study the fundamental details, but sometimes the OPs aren't immediately interested in the details, but just want to get a simple program working.

And IF an OP is really interested in the details, he/she will research about pkg-config, the features which it provides and possibly finally what compiler options like -l<x> or -I<x> mean.

Andi
 
  


Reply

Tags
include


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with inclusion of qt header files namus123 Linux - Desktop 3 06-04-2010 03:06 PM
problem with inclusion of qt header files namus123 Linux - Mobile 2 06-04-2010 05:34 AM
problem in patch file inclusion wagmare Linux - General 1 05-25-2010 07:56 AM


All times are GMT -5. The time now is 03:07 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration