Results 1 to 9 of 9

Thread: ClanLib + Eclipse. Can't compile.

  1. #1

    Default ClanLib + Eclipse. Can't compile.

    Hello all!

    I want to try ClanLib, and i managed to compile and install it. I compiled 2 examples too and they work fine. Now, my problem is, I wan't to use it with Eclipse IDE (using g++ compiler).

    When i try to compile simple example like:

    Code:
    #include "ClanLib-2.2/ClanLib/core.h"
    #include "ClanLib-2.2/ClanLib/application.h"
    
    class ConsoleProgram
    {
    public:
       static int main(const std::vector<CL_String> &args)
       {
           CL_SetupCore setup_core;
           CL_ConsoleWindow console_window("Console", 80, 200);
    
           CL_String now = CL_DateTime::get_current_local_time().to_short_datetime_string();
    
           CL_Console::write_line("At %1, we say Hello ClanLib!", now);
           CL_Console::wait_for_key();
    
           return 0;
       }
    };
    i get these errors:

    Code:
    Description	Resource	Path	Location	Type
    make: *** [ClanLib početak] Error 1	ClanLib početak		 	C/C++ Problem
    undefined reference to `CL_ClanApplication::main'	ClanLib početak		line 65, external location: /usr/local/include/ClanLib-2.2/ClanLib/App/clanapp.h	C/C++ Problem
    undefined reference to `CL_Console::wait_for_key()'	main.cpp	/ClanLib početak	line 15	C/C++ Problem
    undefined reference to `CL_Console::write(CL_StringRef8 const&)'	ClanLib početak		line 198, external location: /usr/local/include/ClanLib-2.2/ClanLib/Core/Text/console.h	C/C++ Problem
    undefined reference to `CL_Console::write(CL_StringRef8 const&)'	ClanLib početak		line 202, external location: /usr/local/include/ClanLib-2.2/ClanLib/Core/Text/console.h	C/C++ Problem
    undefined reference to `CL_ConsoleWindow::~CL_ConsoleWindow()'	main.cpp	/ClanLib početak	line 17	C/C++ Problem
    undefined reference to `CL_ConsoleWindow::CL_ConsoleWindow(CL_StringRef8 const&, int, int)'	main.cpp	/ClanLib početak	line 10	C/C++ Problem
    undefined reference to `CL_DateTime::~CL_DateTime()'	main.cpp	/ClanLib početak	line 12	C/C++ Problem
    undefined reference to `CL_DateTime::get_current_local_time()'	main.cpp	/ClanLib početak	line 12	C/C++ Problem
    undefined reference to `CL_DateTime::to_short_datetime_string() const'	main.cpp	/ClanLib početak	line 12	C/C++ Problem
    undefined reference to `CL_SetupCore::~CL_SetupCore()'	main.cpp	/ClanLib početak	line 17	C/C++ Problem
    undefined reference to `CL_SetupCore::CL_SetupCore()'	main.cpp	/ClanLib početak	line 9	C/C++ Problem
    undefined reference to `CL_String8::~CL_String8()'	main.cpp	/ClanLib početak	line 14	C/C++ Problem
    undefined reference to `CL_String8::~CL_String8()'	main.cpp	/ClanLib početak	line 17	C/C++ Problem
    undefined reference to `CL_String8::CL_String8(CL_String8 const&)'	main.cpp	/ClanLib početak	line 14	C/C++ Problem
    undefined reference to `CL_String8::operator CL_StringRef8() const'	ClanLib početak		line 215, external location: /usr/local/include/ClanLib-2.2/ClanLib/Core/Text/console.h	C/C++ Problem
    undefined reference to `CL_String8::operator CL_StringRef8() const'	ClanLib početak		line 216, external location: /usr/local/include/ClanLib-2.2/ClanLib/Core/Text/console.h	C/C++ Problem
    undefined reference to `CL_StringFormat::~CL_StringFormat()'	ClanLib početak		line 216, external location: /usr/local/include/ClanLib-2.2/ClanLib/Core/Text/console.h	C/C++ Problem
    undefined reference to `CL_StringFormat::CL_StringFormat(CL_StringRef8 const&)'	ClanLib početak		line 214, external location: /usr/local/include/ClanLib-2.2/ClanLib/Core/Text/console.h	C/C++ Problem
    undefined reference to `CL_StringFormat::get_result() const'	ClanLib početak		line 216, external location: /usr/local/include/ClanLib-2.2/ClanLib/Core/Text/console.h	C/C++ Problem
    undefined reference to `CL_StringFormat::set_arg(int, CL_StringRef8 const&)'	ClanLib početak		line 215, external location: /usr/local/include/ClanLib-2.2/ClanLib/Core/Text/console.h	C/C++ Problem
    undefined reference to `CL_StringRef8::~CL_StringRef8()'	ClanLib početak		line 202, external location: /usr/local/include/ClanLib-2.2/ClanLib/Core/Text/console.h	C/C++ Problem
    undefined reference to `CL_StringRef8::~CL_StringRef8()'	ClanLib početak		line 215, external location: /usr/local/include/ClanLib-2.2/ClanLib/Core/Text/console.h	C/C++ Problem
    undefined reference to `CL_StringRef8::~CL_StringRef8()'	ClanLib početak		line 216, external location: /usr/local/include/ClanLib-2.2/ClanLib/Core/Text/console.h	C/C++ Problem
    undefined reference to `CL_StringRef8::~CL_StringRef8()'	main.cpp	/ClanLib početak	line 10	C/C++ Problem
    undefined reference to `CL_StringRef8::~CL_StringRef8()'	main.cpp	/ClanLib početak	line 14	C/C++ Problem
    undefined reference to `CL_StringRef8::CL_StringRef8(char const*)'	ClanLib početak		line 202, external location: /usr/local/include/ClanLib-2.2/ClanLib/Core/Text/console.h	C/C++ Problem
    undefined reference to `CL_StringRef8::CL_StringRef8(char const*)'	main.cpp	/ClanLib početak	line 10	C/C++ Problem
    undefined reference to `CL_StringRef8::CL_StringRef8(char const*)'	main.cpp	/ClanLib početak	line 14	C/C++ Problem
    undefined reference to `main'	ClanLib početak		 	C/C++ Problem
    I'm generally not good with this stuff. Could anyone help me how to set this up to work?

    Thanks in advance!

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Seems you are not linking with clanCore and clanApp. I have no idea how you set that up in Eclipse, but it might help you enough to start looking

  3. #3

    Default

    I have no idea neither. I'm pretty new to all that stuff.

    Name:  Screenshot-10.png
Views: 184
Size:  214.4 KB

    Is this image of any help?

    If not,do you maybe know how to set it up in Code::Blocks?

    I tried search on google for what you've suggested but seems I don't really know what I'm searching for. Didn't find anything useful.

    EDIT:

    I think i managed to link it, i added clan22Core and clan22App to linker, but i still get an error:

    Code:
    **** Build of configuration Debug for project ClanLib početak ****
    
    make all 
    Building target: ClanLib početak
    Invoking: GCC C++ Linker
    g++ -L/usr/local/lib -o"ClanLib početak"  ./main.o   -lclan22Core -lclan22App
    /usr/local/lib/libclan22Core.so: undefined reference to `pthread_mutexattr_destroy'
    /usr/local/lib/libclan22Core.so: undefined reference to `pthread_create'
    /usr/local/lib/libclan22Core.so: undefined reference to `pthread_mutexattr_init'
    /usr/local/lib/libclan22Core.so: undefined reference to `pthread_mutexattr_setkind_np'
    /usr/local/lib/libclan22Core.so: undefined reference to `pthread_detach'
    /usr/local/lib/libclan22Core.so: undefined reference to `pthread_join'
    collect2: ld returned 1 exit status
    make: *** [ClanLib početak] Error 1

  4. #4
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Try adding -lpthread as well (as the docs at http://clanlib.org/wiki/MainDocs:GNU_C%2B%2B_on_Linux says)

  5. #5

    Default

    Whoa,it worked! Thanks a ton!

  6. #6

    Default



    Problems again. When I try to compile this tutorial: http://codegrind.net/2010/09/30/clan...art-2-visuals/

    I get this:

    Code:
    Building target: ClanLib početak
    Invoking: GCC C++ Linker
    g++ -L/usr/local/lib -o"ClanLib početak"  ./main.o   -lclan22Core -lclan22GL -lclan22Display -lpthread -lclan22App
    /usr/local/lib/libclan22Display.so: undefined reference to `FT_New_Memory_Face'
    /usr/local/lib/libclan22Display.so: undefined reference to `XConvertSelection'
    /usr/local/lib/libclan22Display.so: undefined reference to `FcInitLoadConfigAndFonts'
    /usr/local/lib/libclan22Display.so: undefined reference to `XAllocSizeHints'
    /usr/local/lib/libclan22Display.so: undefined reference to `XFreeColormap'
    /usr/local/lib/libclan22Display.so: undefined reference to `XSendEvent'
    /usr/local/lib/libclan22Display.so: undefined reference to `XGetWindowProperty'
    /usr/local/lib/libclan22GL.so: undefined reference to `XSetErrorHandler'
    /usr/local/lib/libclan22Display.so: undefined reference to `FT_Load_Glyph'
    /usr/local/lib/libclan22Display.so: undefined reference to `FcDefaultSubstitute'
    /usr/local/lib/libclan22Display.so: undefined reference to `XQueryTree'
    /usr/local/lib/libclan22Display.so: undefined reference to `FT_Get_Kerning'
    /usr/local/lib/libclan22Display.so: undefined reference to `FT_Glyph_Get_CBox'
    /usr/local/lib/libclan22Display.so: undefined reference to `XSetWMNormalHints'
    /usr/local/lib/libclan22Display.so: undefined reference to `XIconifyWindow'
    /usr/local/lib/libclan22Display.so: undefined reference to `XSetStandardProperties'
    /usr/local/lib/libclan22Display.so: undefined reference to `XSetWMProtocols'
    /usr/local/lib/libclan22Display.so: undefined reference to `XCreateFontCursor'
    /usr/local/lib/libclan22Display.so: undefined reference to `XKeycodeToKeysym'
    /usr/local/lib/libclan22Display.so: undefined reference to `XKeysymToKeycode'
    /usr/local/lib/libclan22Display.so: undefined reference to `FT_Get_Glyph'
    /usr/local/lib/libclan22Display.so: undefined reference to `XCreateColormap'
    /usr/local/lib/libclan22Display.so: undefined reference to `FcPatternGetString'
    /usr/local/lib/libclan22Display.so: undefined reference to `FT_Init_FreeType'
    /usr/local/lib/libclan22Display.so: undefined reference to `XCreatePixmapCursor'
    /usr/local/lib/libclan22Display.so: undefined reference to `dlopen'
    /usr/local/lib/libclan22Display.so: undefined reference to `XInternAtom'
    /usr/local/lib/libclan22Display.so: undefined reference to `FT_Get_Char_Index'
    /usr/local/lib/libclan22Display.so: undefined reference to `XGetWMNormalHints'
    /usr/local/lib/libclan22Display.so: undefined reference to `XInitThreads'
    /usr/local/lib/libclan22Display.so: undefined reference to `XChangeProperty'
    /usr/local/lib/libclan22Display.so: undefined reference to `XLookupString'
    /usr/local/lib/libclan22Display.so: undefined reference to `XMoveResizeWindow'
    /usr/local/lib/libclan22Display.so: undefined reference to `XPending'
    /usr/local/lib/libclan22Display.so: undefined reference to `XPutBackEvent'
    /usr/local/lib/libclan22Display.so: undefined reference to `FcConfigSubstitute'
    /usr/local/lib/libclan22Display.so: undefined reference to `XFreeCursor'
    /usr/local/lib/libclan22Display.so: undefined reference to `XSetSelectionOwner'
    /usr/local/lib/libclan22Display.so: undefined reference to `FcPatternBuild'
    /usr/local/lib/libclan22Display.so: undefined reference to `XMapWindow'
    /usr/local/lib/libclan22Display.so: undefined reference to `XQueryPointer'
    /usr/local/lib/libclan22Display.so: undefined reference to `XRaiseWindow'
    /usr/local/lib/libclan22Display.so: undefined reference to `XCreateBitmapFromData'
    /usr/local/lib/libclan22Display.so: undefined reference to `XQueryKeymap'
    /usr/local/lib/libclan22GL.so: undefined reference to `XFree'
    /usr/local/lib/libclan22Display.so: undefined reference to `XCheckTypedWindowEvent'
    /usr/local/lib/libclan22Display.so: undefined reference to `FcPatternDestroy'
    /usr/local/lib/libclan22Display.so: undefined reference to `XCheckMaskEvent'
    /usr/local/lib/libclan22Display.so: undefined reference to `XOpenDisplay'
    /usr/local/lib/libclan22Display.so: undefined reference to `dlclose'
    /usr/local/lib/libclan22Display.so: undefined reference to `XNextEvent'
    /usr/local/lib/libclan22Display.so: undefined reference to `XResizeWindow'
    /usr/local/lib/libclan22Display.so: undefined reference to `XGetGeometry'
    /usr/local/lib/libclan22GL.so: undefined reference to `dlsym'
    /usr/local/lib/libclan22Display.so: undefined reference to `XUnmapWindow'
    /usr/local/lib/libclan22Display.so: undefined reference to `XWarpPointer'
    /usr/local/lib/libclan22Display.so: undefined reference to `FcFontMatch'
    /usr/local/lib/libclan22Display.so: undefined reference to `XSetTransientForHint'
    /usr/local/lib/libclan22Display.so: undefined reference to `XFlush'
    /usr/local/lib/libclan22Display.so: undefined reference to `XCreateWindow'
    /usr/local/lib/libclan22Display.so: undefined reference to `XDestroyWindow'
    /usr/local/lib/libclan22Display.so: undefined reference to `FT_Done_FreeType'
    /usr/local/lib/libclan22Display.so: undefined reference to `FT_Done_Glyph'
    /usr/local/lib/libclan22Display.so: undefined reference to `XMaskEvent'
    /usr/local/lib/libclan22Display.so: undefined reference to `FT_Set_Char_Size'
    /usr/local/lib/libclan22Display.so: undefined reference to `XGetInputFocus'
    /usr/local/lib/libclan22Display.so: undefined reference to `XDefineCursor'
    /usr/local/lib/libclan22Display.so: undefined reference to `XGetWindowAttributes'
    /usr/local/lib/libclan22Display.so: undefined reference to `XkbSetDetectableAutoRepeat'
    /usr/local/lib/libclan22Display.so: undefined reference to `FT_Render_Glyph'
    /usr/local/lib/libclan22Display.so: undefined reference to `XFreePixmap'
    /usr/local/lib/libclan22Display.so: undefined reference to `XKeysymToString'
    /usr/local/lib/libclan22Display.so: undefined reference to `FT_Done_Face'
    /usr/local/lib/libclan22Display.so: undefined reference to `XCloseDisplay'
    /usr/local/lib/libclan22Display.so: undefined reference to `XSync'
    collect2: ld returned 1 exit status
    make: *** [ClanLib početak] Error 1
    And I think i linked everything that is supposed to be linked. :wheelchair:

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

    Default

    Assuming that you have installed ClanLib (i.e. sudo make install).

    pkg-config --cflags clanCore-2.2 clanDisplay-2.2 clanGL-2.2 clanApp-2.2

    Will give you a list required cflags

    pkg-config --libs clanCore-2.2 clanDisplay-2.2 clanGL-2.2 clanApp-2.2

    Will give you a list required libraries

  8. #8

    Default

    Worked, thanks !

    And sorry for all the stupid questions, but as I said, I'm pretty new to all of this

  9. #9

    Default

    Quote Originally Posted by igorpan View Post
    Whoa,it worked! Thanks a ton!
    Hi, could you please tell me what you did to make Eclipse work with ClanLib?

    Bye and thank you very much.

Similar Threads

  1. Trying to compile ClanLib 8.0 in Visual Studio 6.0
    By antikhaoz in forum Official ClanLib SDK Forums
    Replies: 11
    Last Post: 07-21-2009, 08:08 PM
  2. Problem with Eclipse CDT
    By Nikitto46 in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 04-07-2009, 06:10 PM
  3. Can't compile ClanLib on OpenBSD
    By zmyrgel in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 03-06-2008, 07:57 AM
  4. ClanLib 0.8.0 fails to compile on Ubuntu
    By lixopmstp in forum Official ClanLib SDK Forums
    Replies: 7
    Last Post: 09-04-2007, 05:50 AM
  5. Simple app won't compile when linked with clanlib
    By mmiikkee12 in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 07-17-2007, 02:41 PM

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
  •