Results 1 to 8 of 8

Thread: Can't compile due to missing libraries.

  1. #1

    Default SOLVED Can't compile due to missing libraries.

    Problem solved see this post.
    I am running Ubuntu 10.10, having trouble with #include-ing any of the ClanLib librarys/class files. I followed the steps on compiling and installing from source, and I am using the example make file but I get the following error when I try to run the make file.
    $ make
    g++ -o helloworld -pthread consoleexample.cpp `pkg-config --libs clanCore-2.2 clanApp-2.2`
    consoleexample.cpp:1: fatal error: ClanLib/core.h: No such file or directory
    compilation terminated.
    make: *** [all] Error 1
    Makefile source
    PACKAGES = clanCore-2.2 clanApp-2.2

    CPPFLAGS = `pkg-config --cflags $(PACKAGES)`

    LIBS = `pkg-config --libs $(PACKAGES)`

    OBJS = consoleexample.cpp



    all: $(OBJS)

    g++ -o helloworld -pthread $(OBJS) $(LIBS)



    clean:

    -rm -rf *.o

    -rm consoleexample
    Source Code of consoleexample.cpp
    #include <ClanLib/core.h>
    #include <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_dat etime_string();

    CL_Console::write_line("At %1, we say Hello ClanLib!", now);
    CL_Console::wait_for_key();

    return 0;
    }
    };

    // Create global application object, you MUST include this line or
    // the application start-up will fail to locate your application object.
    CL_ClanApplication app(&ConsoleProgram::main);
    Last edited by Taterade; 12-19-2010 at 04:40 PM. Reason: Solved.

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

    Default

    Either:
    1) You have not compiled and installed ClanLib SDK
    2) You installed the libraries to /usr/local ,that ubuntu does not pick up without a adjusting the library path ( http://linux.die.net/man/8/ldconfig via /etc/ld.so.conf )

    See http://clanlib.org/wiki/MainDocs:GNU_C%2B%2B_on_Linux

  3. #3

    Default

    The file core.h should be in /usr/include/ClanLib-2.2/ClanLib; is it?

    Are you using a ClanLib version other than 2.2.x (eg. latest SVN is 2.3)? If so, you'll need to change the makefile accordingly.

    Did you remember to install (sudo make install) after compiling, and were there any errors during this?

  4. #4

    Default

    Quote Originally Posted by rombust View Post
    Either:
    1) You have not compiled and installed ClanLib SDK
    2) You installed the libraries to /usr/local ,that ubuntu does not pick up without a adjusting the library path ( http://linux.die.net/man/8/ldconfig via /etc/ld.so.conf )

    See http://clanlib.org/wiki/MainDocs:GNU_C%2B%2B_on_Linux
    1) I did compile install, worked fine.
    2) I already did that via google search.
    rebecca.palmer

    The file core.h should be in /usr/include/ClanLib-2.2/ClanLib; is it?

    Are you using a ClanLib version other than 2.2.x (eg. latest SVN is 2.3)? If so, you'll need to change the makefile accordingly.

    Did you remember to install (sudo make install) after compiling, and were there any errors during this?
    I found the library at /usr/include/ClanLib-2.2/ so I am going to try including that in my path now.

  5. #5

    Default

    #Begin /etc/ld.so.conf

    include /etc/ld.so.conf.d/*.conf
    /usr/local/lib
    /usr/include

    #End /etc/ld.so.conf
    Still not getting the program to compile, same error as before.
    Scratch that, I found the solution.
    Changed
    #include <ClanLib/core.h>
    to
    #include <ClanLib-2.2/ClanLib/core.h
    and it was included just fine.

    It should probably be fixed so that the source compilation doesn't make a directory dependant on version number, or should I have put /usr/include/ClanLib-2.2 in my path? It didn't seem prudent to me since /usr/include has a number of libraries to use.

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

    Default

    I have just noticed

    You have:

    $ make
    g++ -o helloworld -pthread consoleexample.cpp `pkg-config --libs clanCore-2.2 clanApp-2.2`
    consoleexample.cpp:1: fatal error: ClanLib/core.h: No such file or directory
    compilation terminated.
    make: *** [all] Error 1
    You need to pass "--cflags" to pkg-config, else it will not include "-I /usr/include/ClanLib-2.2"

  7. #7

    Default

    Quote Originally Posted by rombust View Post
    I have just noticed

    You have:



    You need to pass "--cflags" to pkg-config, else it will not include "-I /usr/include/ClanLib-2.2"
    Even better, thanks, switched
    LIBS = `pkg-config --libs $(PACKAGES)`
    to
    LIBS = `pkg-config --cflags --libs $(PACKAGES)`
    Which indeed fixes the issue, although the CPPFLAGS line already had it.

  8. #8

    Default

    Fixed in the wiki, but I haven't checked if this broken example appears anywhere else.

Similar Threads

  1. Updated ClanLib External Precompiled Libraries
    By rombust in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 07-23-2010, 12:30 PM
  2. missing gui.xml
    By c__chp in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 08-17-2009, 08:35 PM
  3. Trouble Seeing All Installed Libraries
    By jmguy02 in forum Official ClanLib SDK Forums
    Replies: 22
    Last Post: 04-05-2009, 12:22 AM
  4. Threading Libraries?
    By Chambers in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 05-11-2007, 03:31 AM
  5. Am i missing something?
    By MrSi1as in forum Dink Smallwood HD
    Replies: 5
    Last Post: 12-03-2006, 01:23 AM

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
  •