Eclipse CDT, cygwin and linking problems

Discussion in 'C Programming' started by Gotch@, Jan 15, 2008.

  1. Gotch@

    Gotch@ Guest

    Hi all,
    I've installed the CDT plugin for Eclipse and I want to use it to work
    on C/C++ projects under Cygwin. It works, in fact it compiles and runs
    the usual helloworld c++ program. Now it comes difficult when I try to
    add external libs. Such as... GTK. Let's explain what I tried. (oh
    well, I'm using Eclipse Europa 3.3.1 and CDT 4.0.1). First I just
    added the path of the cygwin includes throug the project->properties-
    >C/C++ General->Paths and Symbols window. I added in Includes under

    GNU C the path to the gtk-2.0 includes in cygwin/usr/include/gtk-2.0
    folder. No effect. It says that it couldn't find gtk/gtk.h . So, since
    it's a C++ project, I tried to add them under GNU C++. As a result the
    compiler starts putting out messages about every header in the library
    compelling that ISO C forbids this and that...
    Let's note that my include is
    #include <gtk/gtk.h> but i get the same results with <gtk.h> and "gtk/
    gtk.h".

    I don't get it, but I'd like to use eclipse to devlop in C/C++ because
    of positive Java experiences.

    Do you have any ideas, most tutorials on the topic are outdated and
    the old CDT is quite different, especially regarding the project
    types.
    Gotch@, Jan 15, 2008
    #1
    1. Advertising

  2. Gotch@

    jacob navia Guest

    Gotch@ wrote:
    > Hi all,
    > I've installed the CDT plugin for Eclipse and I want to use it to work
    > on C/C++ projects under Cygwin. It works, in fact it compiles and runs
    > the usual helloworld c++ program. Now it comes difficult when I try to
    > add external libs. Such as... GTK. Let's explain what I tried. (oh
    > well, I'm using Eclipse Europa 3.3.1 and CDT 4.0.1). First I just
    > added the path of the cygwin includes throug the project->properties-
    >> C/C++ General->Paths and Symbols window. I added in Includes under

    > GNU C the path to the gtk-2.0 includes in cygwin/usr/include/gtk-2.0
    > folder. No effect. It says that it couldn't find gtk/gtk.h .


    You addedd the path to
    /usr/include/gtk-2.0 BUT the code expects
    /usr/include/gtk

    Try to make a symbolic link of gtk-2.0 to gtk



    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
    jacob navia, Jan 15, 2008
    #2
    1. Advertising

  3. Gotch@

    Gotch@ Guest

    The symlink is not seen by Windows file access routines... I'll try to
    just rename the folder... hope this wuoldn't break up anything...

    On 15 Gen, 14:45, jacob navia <> wrote:
    > Gotch@ wrote:
    > > Hi all,
    > > I've installed the CDT plugin for Eclipse and I want to use it to work
    > > on C/C++ projects under Cygwin. It works, in fact it compiles and runs
    > > the usual helloworld c++ program. Now it comes difficult when I try to
    > > add external libs. Such as... GTK. Let's explain what I tried. (oh
    > > well, I'm using Eclipse Europa 3.3.1 and CDT 4.0.1). First I just
    > > added the path of the cygwin includes throug the project->properties-
    > >> C/C++ General->Paths and Symbols window. I added in Includes under

    > > GNU C the path to the gtk-2.0 includes in cygwin/usr/include/gtk-2.0
    > > folder. No effect. It says that it couldn't find gtk/gtk.h .

    >
    > You addedd the path to
    > /usr/include/gtk-2.0 BUT the code expects
    > /usr/include/gtk
    >
    > Try to make a symbolic link of gtk-2.0 to gtk
    >
    > --
    > jacob navia
    > jacob at jacob point remcomp point fr
    > logiciels/informatiquehttp://www.cs.virginia.edu/~lcc-win32
    Gotch@, Jan 15, 2008
    #3
  4. "Gotch@" <> writes:
    >
    > On 15 Gen, 14:45, jacob navia <> wrote:
    >> Gotch@ wrote:
    >> > Hi all,
    >> > I've installed the CDT plugin for Eclipse and I want to use it to work
    >> > on C/C++ projects under Cygwin. It works, in fact it compiles and runs
    >> > the usual helloworld c++ program. Now it comes difficult when I try to
    >> > add external libs. Such as... GTK. Let's explain what I tried. (oh
    >> > well, I'm using Eclipse Europa 3.3.1 and CDT 4.0.1). First I just
    >> > added the path of the cygwin includes throug the project->properties-
    >> >> C/C++ General->Paths and Symbols window. I added in Includes under
    >> > GNU C the path to the gtk-2.0 includes in cygwin/usr/include/gtk-2.0
    >> > folder. No effect. It says that it couldn't find gtk/gtk.h .

    >>
    >> You addedd the path to
    >> /usr/include/gtk-2.0 BUT the code expects
    >> /usr/include/gtk
    >>
    >> Try to make a symbolic link of gtk-2.0 to gtk

    >
    > The symlink is not seen by Windows file access routines... I'll try to
    > just rename the folder... hope this wuoldn't break up anything...


    Your question is about Cygwin, Eclipse, and CDT, not about the C
    programming language. If you want help, you should ask in a forum
    where these things are topical. Possibly one of the Cygwin mailing
    lists would be helpful (see www.cygwin.com), or perhaps a forum that
    deals with Eclipse.

    --
    Keith Thompson (The_Other_Keith) <>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Jan 15, 2008
    #4
  5. Gotch@

    Flash Gordon Guest

    Gotch@ wrote, On 15/01/08 17:17:
    > The symlink is not seen by Windows file access routines... I'll try to
    > just rename the folder... hope this wuoldn't break up anything...


    <snip>

    This is not topical here for two reasons
    1) You state you are using C++, that is not the language we discuss here
    2) Your problem is with your tools rather than the language.

    I'm sure there are Eclipse mailing lists, I suggest you try checking
    them out, finding the correct one, and asking there. Or possibly on the
    gcc, Cygwin or GTK mailing lists, as your problem might be with those
    rather than Eclipse itself. However *check* what is topical before
    posting your question somewhere else.
    --
    Flash Gordon
    Flash Gordon, Jan 15, 2008
    #5
  6. Gotch@

    jacob navia Guest

    Flash Gordon wrote:
    > Gotch@ wrote, On 15/01/08 17:17:
    >> The symlink is not seen by Windows file access routines... I'll try to
    >> just rename the folder... hope this wuoldn't break up anything...

    >
    > <snip>
    >
    > This is not topical here for two reasons
    > 1) You state you are using C++, that is not the language we discuss here
    > 2) Your problem is with your tools rather than the language.
    >
    > I'm sure there are Eclipse mailing lists, I suggest you try checking
    > them out, finding the correct one, and asking there. Or possibly on the
    > gcc, Cygwin or GTK mailing lists, as your problem might be with those
    > rather than Eclipse itself. However *check* what is topical before
    > posting your question somewhere else.


    Actually it is a language problem

    He added
    \include\gtk-2.0 (what is equivalent to calling the compiler
    with -I\include\gtk-2.0) but the source code expects
    \include\gtk.

    Note that when you write
    #include <gtk/gtk.h>
    the language supposes that directories exist and that there
    is a subdirectory "gtk" in the normal system includes
    directory. The user had a problem with the spelling of the path, not
    with Eclipse/C++/whatever

    I expect that in a group about C we can give people a hand
    spotting those errors that are trivial, but somehow our
    brain refuses to see.

    How many times I have misspelled a variable and couldn't
    find the error?


    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
    jacob navia, Jan 15, 2008
    #6
  7. Gotch@

    CJ Guest

    On 15 Jan 2008 at 20:51, jacob navia wrote:
    > How many times I have misspelled a variable and couldn't
    > find the error?


    Perhaps you should switch to a compiler that issues a useful diagnostic
    message for undeclared variables?
    CJ, Jan 15, 2008
    #7
  8. Gotch@

    jacob navia Guest

    CJ wrote:
    > On 15 Jan 2008 at 20:51, jacob navia wrote:
    >> How many times I have misspelled a variable and couldn't
    >> find the error?

    >
    > Perhaps you should switch to a compiler that issues a useful diagnostic
    > message for undeclared variables?
    >


    If the variable wasn't defined. The *real* problem is when you
    have some variable that *is* defined but it is not the one
    you want.

    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
    jacob navia, Jan 15, 2008
    #8
  9. jacob navia <> writes:
    > Flash Gordon wrote:
    >> Gotch@ wrote, On 15/01/08 17:17:
    >>> The symlink is not seen by Windows file access routines... I'll try to
    >>> just rename the folder... hope this wuoldn't break up anything...

    >>
    >> <snip>
    >>
    >> This is not topical here for two reasons
    >> 1) You state you are using C++, that is not the language we discuss here
    >> 2) Your problem is with your tools rather than the language.
    >>
    >> I'm sure there are Eclipse mailing lists, I suggest you try checking
    >> them out, finding the correct one, and asking there. Or possibly on
    >> the gcc, Cygwin or GTK mailing lists, as your problem might be with
    >> those rather than Eclipse itself. However *check* what is topical
    >> before posting your question somewhere else.

    >
    > Actually it is a language problem
    >
    > He added
    > \include\gtk-2.0 (what is equivalent to calling the compiler
    > with -I\include\gtk-2.0) but the source code expects
    > \include\gtk.
    >
    > Note that when you write
    > #include <gtk/gtk.h>
    > the language supposes that directories exist and that there
    > is a subdirectory "gtk" in the normal system includes
    > directory.

    [...]

    The *language* does no such thing; an implementation very likely does.

    C99 6.10.2p2:

    A preprocessing directive of the form

    # include <h-char-sequence> new-line

    searches a sequence of implementation-defined places for a header
    identified uniquely by the specified sequence between the < and >
    delimiters, and causes the replacement of that directive by the
    entire contents of the header. How the places are specified or the
    header identified is implementation-defined.

    Note the lack of any mention of directories or subdirectories, or of
    any implication that '/' is a directory path delimiter.

    Even if you think this is nitpicking, that it's obvious that <gtk/...>
    must refer to a directory named "gtk", it's not at all obvious what
    the proper solution is. I doubt that either creating a symlink or
    renaming the folder is the right approach.

    <OT>

    You wrote:

    You addedd the path to
    /usr/include/gtk-2.0 BUT the code expects
    /usr/include/gtk

    Try to make a symbolic link of gtk-2.0 to gtk

    But in fact, on my Cygwin installation the header file the OP is
    looking for is at /usr/include/gtk-2.0/gtk/gtk.h (note that "gtk" is a
    subdirectory of "gtk-2.0"().

    My best guess is that the problem is a confusion between Windows and
    Cygwin paths (the directory "/usr/include/gtk-2.0" as seen from Cygwin
    might be called, for example, "C:\cygwin\usr\include\gtk-2.0" as seen
    from Windows). If that's the problem, a Cygwin mailing list would
    be the best place to ask about it.

    </OT>

    --
    Keith Thompson (The_Other_Keith) <>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Jan 15, 2008
    #9
  10. On Tue, 15 Jan 2008 22:07:18 +0100, jacob navia wrote:

    > CJ wrote:
    >> On 15 Jan 2008 at 20:51, jacob navia wrote:
    >>> How many times I have misspelled a variable and couldn't
    >>> find the error?

    >>
    >> Perhaps you should switch to a compiler that issues a useful diagnostic
    >> message for undeclared variables?
    >>

    >
    > If the variable wasn't defined. The *real* problem is when you
    > have some variable that *is* defined but it is not the one
    > you want.



    I'd tend to think that if you're encountering this, your choice of
    variable names is perhaps more at fault than anything, no?
    Kelsey Bjarnason, Jan 16, 2008
    #10
  11. Gotch@

    Guest

    On Jan 15, 8:27 am, "Gotch@" <> wrote:
    > Hi all,
    > I've installed the CDT plugin for Eclipse and I want to use it to work
    > on C/C++ projects under Cygwin. It works, in fact it compiles and runs
    > the usual helloworld c++ program. Now it comes difficult when I try to
    > add external libs. Such as... GTK. Let's explain what I tried. (oh
    > well, I'm using Eclipse Europa 3.3.1 and CDT 4.0.1). First I just
    > added the path of the cygwin includes throug the project->properties->C/C++ General->Paths and Symbols window. I added in Includes under
    >
    > GNU C the path to the gtk-2.0 includes in cygwin/usr/include/gtk-2.0
    > folder. No effect. It says that it couldn't find gtk/gtk.h . So, since
    > it's a C++ project, I tried to add them under GNU C++. As a result the
    > compiler starts putting out messages about every header in the library
    > compelling that ISO C forbids this and that...
    > Let's note that my include is
    > #include <gtk/gtk.h> but i get the same results with <gtk.h> and "gtk/
    > gtk.h".
    >
    > I don't get it, but I'd like to use eclipse to devlop in C/C++ because
    > of positive Java experiences.
    >
    > Do you have any ideas, most tutorials on the topic are outdated and
    > the old CDT is quite different, especially regarding the project
    > types.


    find out product of two matrix
    , Jan 24, 2008
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ann

    Eclipse CDT and JNI

    Ann, Oct 24, 2004, in forum: Java
    Replies:
    1
    Views:
    1,563
    IchBin
    Oct 25, 2004
  2. peter
    Replies:
    0
    Views:
    678
    peter
    May 12, 2005
  3. adrin

    eclipse and CDT debugging problem

    adrin, Feb 13, 2007, in forum: C Programming
    Replies:
    2
    Views:
    425
    Roberto Waltman
    Feb 13, 2007
  4. AnonymousFC4
    Replies:
    0
    Views:
    313
    AnonymousFC4
    Feb 25, 2006
  5. Joachim Dahl
    Replies:
    3
    Views:
    371
    Fabio Zadrozny
    Nov 6, 2008
Loading...

Share This Page