Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > gtk in cygwin

Reply
Thread Tools

gtk in cygwin

 
 
johnmmcparland
Guest
Posts: n/a
 
      04-18-2007
Hi all,

I am doing some C / C++ programming in cygwin and I notice when I add
something to my path then try to compile, the gcc / g++ compiler
cannot find some files, even though they are in the directory I may
have just added to my path.

For example I have copied the example program from http://www.gtk.org/tutorial/c39.html
and when I compiled it, the compiler couldn't find gtk/gtk.h.

I thought to solve this I would have to add the path to gtk/gtk.h to
my path and so I did;

> PATH=$PATH:/usr/include/gtk-2.0


then I compiled again and while it found gtk.h it could not find a lot
of other gtk headers, such as gtktext.h. However this and the other
files which were not found are also in /usr/include/gtk-2.0 and they
are included as <gtk/gtktext.h>.

I'm guessing that my path has not been set right but I'm fumbling in
the dark. If someone could help it would be greatly appreciated.

John

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      04-18-2007
johnmmcparland wrote:
> I am doing some C / C++ programming in cygwin and I notice when I add
> something to my path then try to compile, the gcc / g++ compiler
> cannot [..]
>
> I'm guessing that my path has not been set right but I'm fumbling in
> the dark. If someone could help it would be greatly appreciated.


Somebody in 'gnu.g++.help' should be able to.


 
Reply With Quote
 
 
 
 
bjeremy
Guest
Posts: n/a
 
      04-18-2007

johnmmcparland wrote:
> Hi all,
>
> I am doing some C / C++ programming in cygwin and I notice when I add
> something to my path then try to compile, the gcc / g++ compiler
> cannot find some files, even though they are in the directory I may
> have just added to my path.
>
> For example I have copied the example program from http://www.gtk.org/tutorial/c39.html
> and when I compiled it, the compiler couldn't find gtk/gtk.h.
>
> I thought to solve this I would have to add the path to gtk/gtk.h to
> my path and so I did;
>
> > PATH=$PATH:/usr/include/gtk-2.0

>
> then I compiled again and while it found gtk.h it could not find a lot
> of other gtk headers, such as gtktext.h. However this and the other
> files which were not found are also in /usr/include/gtk-2.0 and they
> are included as <gtk/gtktext.h>.
>
> I'm guessing that my path has not been set right but I'm fumbling in
> the dark. If someone could help it would be greatly appreciated.
>
> John


Not sure if this helps, but if you are trying to compile from an
application outside a Cygwin shell (i.e. Eclipse or other IDE), you
may need to add the path to your windows environment variables...
You'll need to add the to the windows directory where the executable
lives, not the directory structure used by Cygwin.

 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      04-19-2007
On Apr 18, 2:55 pm, johnmmcparland <(E-Mail Removed)>
wrote:

> I am doing some C / C++ programming in cygwin and I notice when I add
> something to my path then try to compile, the gcc / g++ compiler
> cannot find some files, even though they are in the directory I may
> have just added to my path.


> For example I have copied the example program fromhttp://www.gtk.org/tutorial/c39.html
> and when I compiled it, the compiler couldn't find gtk/gtk.h.


> I thought to solve this I would have to add the path to gtk/gtk.h to
> my path and so I did;


> > PATH=$PATH:/usr/include/gtk-2.0


> then I compiled again and while it found gtk.h it could not find a lot
> of other gtk headers, such as gtktext.h. However this and the other
> files which were not found are also in /usr/include/gtk-2.0 and they
> are included as <gtk/gtktext.h>.


> I'm guessing that my path has not been set right but I'm fumbling in
> the dark. If someone could help it would be greatly appreciated.


This is really somewhat platform specific, but on Unix and
Windows platforms, $PATH (or %PATH% in a Windows shell)
specifies where the system should look for executables (and
dynamically linked objects under Windows), and has nothing to do
with include files. The de facto standard for specifying
include file paths is the compiler option -I (or /I under
Windows); depending on the compiler you may or may not need a
space between the -I and the path name. (I think g++ accepts it
both ways, but other Unix compilers don't accept the space.)
Some compilers will also have a special environment variable
which will be added to the list---I think $INCLUDE (or
%INCLUDE%, if you're using the standard Windows shell) works
with VC++, for example---but this is not universal. The normal
procedure is to add the -I options to the flags passed to the
compiler in the makefile.

Note that having done this, you may need something similar for
the libraries. Here, systems differ more; under Unix, it is
generally possible to specify library paths using a -L option,
but I don't think this works under Windows. A more portable
solution is to just specify the library path completely.f

Finally, if the library is in fact a dynamically loaded object
(.DLL or .so), you might have to add something to a path
variable so that the executable will find it: Unix generally
uses a separate variable, LD_LIBRARY_PATH (and puts such objects
in a separate directory), whereas Windows just uses the standard
$PATH (and puts such objects in the same directory as the
executables).

--
James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

 
Reply With Quote
 
Lionel B
Guest
Posts: n/a
 
      04-19-2007
On Wed, 18 Apr 2007 05:55:11 -0700, johnmmcparland wrote:

> Hi all,
>
> I am doing some C / C++ programming in cygwin and I notice when I add
> something to my path then try to compile, the gcc / g++ compiler cannot
> find some files, even though they are in the directory I may have just
> added to my path.
>
> For example I have copied the example program from
> http://www.gtk.org/tutorial/c39.html and when I compiled it, the
> compiler couldn't find gtk/gtk.h.
>
> I thought to solve this I would have to add the path to gtk/gtk.h to my
> path and so I did;
>
>> PATH=$PATH:/usr/include/gtk-2.0

>
> then I compiled again and while it found gtk.h it could not find a lot
> of other gtk headers, such as gtktext.h. However this and the other
> files which were not found are also in /usr/include/gtk-2.0 and they are
> included as <gtk/gtktext.h>.
>
> I'm guessing that my path has not been set right but I'm fumbling in the
> dark. If someone could help it would be greatly appreciated.


Don't know about Cygwin, but on other unix-like systems it is common to
use a utility called pkg-config:

http://pkgconfig.freedesktop.org/wiki/

to set up compiler/linker options for (amongst other libraries) gtk+. For
instance on my (linux) system, I get:

$ pkg-config --cflags gtk+
-I/usr/include/gtk-1.2 -I/usr/X11R6/include -I/usr/include/glib-1.2 -I/usr/lib64/glib/include

$ pkg-config --libs gtk+
-L/usr/X11R6/lib64 -lgtk -lgdk -lXi -lXext -lX11 -lm -lglib

so you can compile a program accessing gtk+ with something like:

g++ ... `pkg-config --cflags gtk+` ...

(note the back quotes) and link with:

g++ ... `pkg-config --libs gtk+` ...

(you may need to specify gtk+-2.0 if you have multiple versions of gtk+)

See also:

http://www.gtk.org/faq/#AEN409

HTH,

--
Lionel B
 
Reply With Quote
 
Mumia W.
Guest
Posts: n/a
 
      04-19-2007
On 04/18/2007 07:55 AM, johnmmcparland wrote:
> Hi all,
>
> I am doing some C / C++ programming in cygwin and I notice when I add
> something to my path then try to compile, the gcc / g++ compiler
> cannot find some files, even though they are in the directory I may
> have just added to my path.
>
> For example I have copied the example program from http://www.gtk.org/tutorial/c39.html
> and when I compiled it, the compiler couldn't find gtk/gtk.h.
>
> I thought to solve this I would have to add the path to gtk/gtk.h to
> my path and so I did;
>
>> PATH=$PATH:/usr/include/gtk-2.0

>
> then I compiled again and while it found gtk.h it could not find a lot
> of other gtk headers, such as gtktext.h. However this and the other
> files which were not found are also in /usr/include/gtk-2.0 and they
> are included as <gtk/gtktext.h>.
>
> I'm guessing that my path has not been set right but I'm fumbling in
> the dark. If someone could help it would be greatly appreciated.
>
> John
>


You would have to add /usr/include/gtk-2.0 to the compiler's include
path. For g++, that might be done by setting the -I option, e.g.:

g++ -I /usr/include/gtk-2.0 myprogram.cc -o myprogram

For other compiler's, the methods will be different. You should ask in a
newsgroup dedicated to your compiler.


--
Count the YOYOs:
http://home.earthlink.net/~mumia.w.18.spam/games_fever/
 
Reply With Quote
 
Jim Langston
Guest
Posts: n/a
 
      04-19-2007
"johnmmcparland" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> Hi all,
>
> I am doing some C / C++ programming in cygwin and I notice when I add
> something to my path then try to compile, the gcc / g++ compiler
> cannot find some files, even though they are in the directory I may
> have just added to my path.
>
> For example I have copied the example program from
> http://www.gtk.org/tutorial/c39.html
> and when I compiled it, the compiler couldn't find gtk/gtk.h.
>
> I thought to solve this I would have to add the path to gtk/gtk.h to
> my path and so I did;
>
>> PATH=$PATH:/usr/include/gtk-2.0

>
> then I compiled again and while it found gtk.h it could not find a lot
> of other gtk headers, such as gtktext.h. However this and the other
> files which were not found are also in /usr/include/gtk-2.0 and they
> are included as <gtk/gtktext.h>.
>
> I'm guessing that my path has not been set right but I'm fumbling in
> the dark. If someone could help it would be greatly appreciated.


Off topic, but I believe it's because you're using a colon : instead of a
semi-colon ;

Try changing from
PATH=$PATH:/usr/include/gtk-2.0
to
PATH=$PATH;/usr/include/gtk-2.0


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ruby GTK Fortune Cookies (gtk-fortune-0.1.1) Alex Shulgin Ruby 1 11-21-2007 01:05 AM
GTK+, segmentation fault in gtK-editable_get_chars zombek@gmail.com C Programming 2 05-29-2007 03:27 PM
compiling ruby under windows (+ gtk stuff, is the gtk list dead?) Gergely Kontra Ruby 2 06-18-2004 10:20 PM
confirm unsubscribe from cygwin-announce@cygwin.com cygwin-announce-help@cygwin.com Python 0 09-05-2003 01:29 AM
confirm unsubscribe from cygwin@cygwin.com cygwin-help@cygwin.com Python 0 09-04-2003 06:34 PM



Advertisments