Results 1 to 6 of 6

Thread: Problem with Eclipse CDT

  1. #1

    Default Problem with Eclipse CDT

    Hi!
    I have a problem with compile the first program with eclipse.
    In eclipse I create a project "Managed Make C++ Project" , in project I create a file.cpp with code :
    #include <ClanLib/core.h>
    #include <ClanLib/application.h>
    #include <ClanLib/display.h>
    #include <ClanLib/gl.h>

    class MyApp : public CL_ClanApplication
    {
    public:
    virtual int main(int argc, char **argv)
    {
    CL_ConsoleWindow console("Console");
    console.redirect_stdio();

    try
    {
    CL_SetupCore setup_core;
    CL_SetupDisplay setup_display;
    CL_SetupGL setup_gl;

    CL_DisplayWindow window("ClanLib application", 640, 480);

    while (!CL_Keyboard::get_keycode(CL_KEY_ESCAPE))
    {
    CL_Display::clear(CL_Color(0, 0, 50));

    CL_Display::flip();

    CL_System::keep_alive(10);
    }
    }
    catch (CL_Error err)
    {
    std::cout << err.message.c_str() << std::endl;
    }

    console.display_close_message();

    return 0;
    }
    } app;

    and when compile this error appear :

    "undefined reference to main"
    "undefined reference to CL_ClanApplication::CL_ClanApplication"
    etc.

    Why??
    I insert in my project the directory of clanlib include..
    Please help me

  2. #2

    Default

    I resolved my problem :
    I insert in properties of project in tash C/C++ Build->GCC C++ Linker->Miscellaneus
    Linker flags : 'pkg-config --libs clanCore-0.8 clanDisplay-0.8 clanApp-0.8 clanGL-0.8'

  3. #3
    Lesser Knight jmguy02's Avatar
    Join Date
    Apr 2009
    Location
    Georgia
    Posts
    43

    Default Same Problem But Your Solution Doesn't Fix

    I'm having the same issue with Eclipse CDT and have some questions.

    How did you get your *.h files into a simple ClanLib location? Mine are deep within a ClanLib-0.8.1 directory ClanLib-0.8.1/Sources/API/*.h.

    I have included your fix into my linker flags too and none of my header files can be found even though I know they are there because I looked. How do I get Eclipse to see them?

    Here's what I'm getting:

    make all
    Building target: clanlibtry
    Invoking: GCC C++ Linker
    g++ pkgconfig --libs clanCore-0.8.1 clanDisplay-0.8.1 clanApp-0.8.1 clanGL-0.8.1 -o"clanlibtry" ./src/clanlibtry.o
    g++: pkgconfig: No such file or directory
    g++: clanCore-0.8.1: No such file or directory
    g++: clanDisplay-0.8.1: No such file or directory
    g++: clanApp-0.8.1: No such file or directory
    g++: clanGL-0.8.1: No such file or directory
    make: *** [clanlibtry] Error 1

    Before I really messed up my system I was getting that "undefined reference to main" error too.

    Any suggestions?

  4. #4
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Quote Originally Posted by jmguy02 View Post
    g++: pkgconfig: No such file or directory
    Any suggestions?
    Install pkgconfig

    And maybe you need the " ' " smybol in 'pkg-config --libs clanCore-0.8 clanDisplay-0.8 clanApp-0.8 clanGL-0.8'

    I don't know eclipse

  5. #5
    Lesser Knight jmguy02's Avatar
    Join Date
    Apr 2009
    Location
    Georgia
    Posts
    43

    Default

    Ah, okay.

    Yes!, I have seen that before where the single quotes are used. Didn't think about leaving those in. I'll give that a try.

  6. #6
    Lesser Knight jmguy02's Avatar
    Join Date
    Apr 2009
    Location
    Georgia
    Posts
    43

    Default Something missing still for Eclipse

    Trying to use Eclipse CDT now and have added 'pkg-config --libs clanCore-0.8 clanDisplay-0.8 clanApp-0.8 clanGL-0.8' to my miscellaneous linker flags section. Still not finding ClanLib libraries.

    Making manually via Bash is fine with no troubles anywhere. Any ideas what I'm still missing to get Eclipse working? Only error receiving is that files not found, meaning libraries.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •