Results 1 to 14 of 14

Thread: Compile problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Peasant
    Join Date
    Jan 2011
    Posts
    6

    Unhappy Compile problem

    I'm new in ClanLib. I wanted to try simple Console ClanLib program:
    Code:
    #include <ClanLib/core.h>
    #include <ClanLib/application.h>
     
    class ConsoleProgram {
     public:
        static int main(const std::vector<CL_String> &args);
    };
         
    // Create global application object:
    // You MUST include this line or the application start-up will fail to
    // locate your console application object.
    CL_ClanApplication app(&ConsoleProgram::main);
          
    int ConsoleProgram::main(const std::vector<CL_String> &args){
        // Setup clanCore:
        CL_SetupCore setup_core;
        	 
        // Create a console Window if one does not exist:
        CL_ConsoleWindow console_window("Console");
        		 
        // Write a line to the console:
        CL_Console::write_line("Hello World!");
        			 
        // Wait for a key so the window won't close immediately.
        CL_Console::wait_for_key();
        			             
        return 0;
    }
    But i can't compile it. I get this error:

    Code:
    $ g++ test.cpp
    test.cpp:1:26: error: ClanLib/core.h: The directory or file does not exist
    test.cpp:2:33: error: ClanLib/application.h: The directory or file does not exist
    test.cpp:6: error: expected unqualified-id before ‘<’ token
    test.cpp:6: error: expected ‘)’ before ‘<’ token
    test.cpp:6: error: expected ‘;’ before ‘<’ token
    test.cpp:12: error: ‘CL_ClanApplication’ does not name a type
    test.cpp:14: error: expected unqualified-id before ‘<’ token
    test.cpp:14: error: expected ‘)’ before ‘<’ token
    test.cpp:14: error: expected initializer before ‘<’ token
    I installed ClanLib according to this tutorial.

    When I tried use this:
    Code:
    #include "/usr/local/include/ClanLib-2.2/ClanLib/core.h"
    #include "/usr/local/include/ClanLib-2.2/ClanLib/application.h"
    #include <vector>
    I got bigger error then before.
    Code:
    $ g++ test.cpp
    test.cpp:1:45: error: /usr/local/include/ClanLib/core.h: Adresář nebo soubor neexistuje
    test.cpp:2:52: error: /usr/local/include/ClanLib/application.h: Adresář nebo soubor neexistuje
    test.cpp:7: error: ‘CL_String’ was not declared in this scope
    test.cpp:7: error: template argument 1 is invalid
    test.cpp:7: error: template argument 2 is invalid
    test.cpp: In static member function ‘static int ConsoleProgram::main(const int&)’:
    test.cpp:8: error: ‘CL_SetupCore’ was not declared in this scope
    test.cpp:8: error: expected ‘;’ before ‘setup_core’
    test.cpp:9: error: ‘CL_ConsoleWindow’ was not declared in this scope
    test.cpp:9: error: expected ‘;’ before ‘console_window’
    test.cpp:11: error: ‘CL_String’ was not declared in this scope
    test.cpp:11: error: expected ‘;’ before ‘now’
    test.cpp:12: error: ‘CL_Console’ has not been declared
    test.cpp:12: error: ‘now’ was not declared in this scope
    test.cpp:13: error: ‘CL_Console’ has not been declared
    test.cpp: At global scope:
    test.cpp:18: error: ‘CL_ClanApplication’ does not name a type
    [jan][jan@doma.net][test]$ g++ test.cpp
    /usr/lib/gcc/i586-manbo-linux-gnu/4.4.3/../../../crt1.o: In function `_start':
    /home/qateam/rpm/BUILD/glibc-2.11.1/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main'
    /tmp//cczJKzcd.o: In function `CL_Console::write_line(CL_StringRef8 const&)':
    test.cpp:(.text._ZN10CL_Console10write_lineERK13CL_StringRef8[CL_Console::write_line(CL_StringRef8 const&)]+0xf): undefined reference to `CL_Console::write(CL_StringRef8 const&)'
    test.cpp:(.text._ZN10CL_Console10write_lineERK13CL_StringRef8[CL_Console::write_line(CL_StringRef8 const&)]+0x22): undefined reference to `CL_StringRef8::CL_StringRef8(char const*)'
    test.cpp:(.text._ZN10CL_Console10write_lineERK13CL_StringRef8[CL_Console::write_line(CL_StringRef8 const&)]+0x2d): undefined reference to `CL_Console::write(CL_StringRef8 const&)'
    test.cpp:(.text._ZN10CL_Console10write_lineERK13CL_StringRef8[CL_Console::write_line(CL_StringRef8 const&)]+0x38): undefined reference to `CL_StringRef8::~CL_StringRef8()'
    test.cpp:(.text._ZN10CL_Console10write_lineERK13CL_StringRef8[CL_Console::write_line(CL_StringRef8 const&)]+0x4e): undefined reference to `CL_StringRef8::~CL_StringRef8()'
    /tmp//cczJKzcd.o: In function `CL_ClanApplication::CL_ClanApplication(int (*)(std::vector<CL_String8, std::allocator<CL_String8> > const&))':
    test.cpp:(.text._ZN18CL_ClanApplicationC1EPFiRKSt6vectorI10CL_String8SaIS1_EEE[CL_ClanApplication::CL_ClanApplication(int (*)(std::vector<CL_String8, std::allocator<CL_String8> > const&))]+0x7): undefined reference to `CL_ClanApplication::main'
    /tmp//cczJKzcd.o: In function `ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)':
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x15): undefined reference to `CL_SetupCore::CL_SetupCore()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x28): undefined reference to `CL_StringRef8::CL_StringRef8(char const*)'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x4d): undefined reference to `CL_ConsoleWindow::CL_ConsoleWindow(CL_StringRef8 const&, int, int)'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x58): undefined reference to `CL_StringRef8::~CL_StringRef8()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x69): undefined reference to `CL_StringRef8::~CL_StringRef8()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x7d): undefined reference to `CL_DateTime::get_current_local_time()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x95): undefined reference to `CL_DateTime::to_short_datetime_string() const'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0xa3): undefined reference to `CL_DateTime::~CL_DateTime()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0xb4): undefined reference to `CL_DateTime::~CL_DateTime()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0xd2): undefined reference to `CL_String8::CL_String8(CL_String8 const&)'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0xe5): undefined reference to `CL_StringRef8::CL_StringRef8(char const*)'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x102): undefined reference to `CL_StringRef8::~CL_StringRef8()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x113): undefined reference to `CL_StringRef8::~CL_StringRef8()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x124): undefined reference to `CL_String8::~CL_String8()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x135): undefined reference to `CL_String8::~CL_String8()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x140): undefined reference to `CL_Console::wait_for_key()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x153): undefined reference to `CL_String8::~CL_String8()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x167): undefined reference to `CL_String8::~CL_String8()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x17b): undefined reference to `CL_ConsoleWindow::~CL_ConsoleWindow()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x18f): undefined reference to `CL_ConsoleWindow::~CL_ConsoleWindow()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x1a3): undefined reference to `CL_SetupCore::~CL_SetupCore()'
    test.cpp:(.text._ZN14ConsoleProgram4mainERKSt6vectorI10CL_String8SaIS1_EE[ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)]+0x1c1): undefined reference to `CL_SetupCore::~CL_SetupCore()'
    /tmp//cczJKzcd.o: In function `void CL_Console::write_line<CL_String8>(CL_StringRef8 const&, CL_String8)':
    test.cpp:(.text._ZN10CL_Console10write_lineI10CL_String8EEvRK13CL_StringRef8T_[void CL_Console::write_line<CL_String8>(CL_StringRef8 const&, CL_String8)]+0x19): undefined reference to `CL_StringFormat::CL_StringFormat(CL_StringRef8 const&)'
    test.cpp:(.text._ZN10CL_Console10write_lineI10CL_String8EEvRK13CL_StringRef8T_[void CL_Console::write_line<CL_String8>(CL_StringRef8 const&, CL_String8)]+0x2b): undefined reference to `CL_String8::operator CL_StringRef8() const'
    test.cpp:(.text._ZN10CL_Console10write_lineI10CL_String8EEvRK13CL_StringRef8T_[void CL_Console::write_line<CL_String8>(CL_StringRef8 const&, CL_String8)]+0x48): undefined reference to `CL_StringFormat::set_arg(int, CL_StringRef8 const&)'
    test.cpp:(.text._ZN10CL_Console10write_lineI10CL_String8EEvRK13CL_StringRef8T_[void CL_Console::write_line<CL_String8>(CL_StringRef8 const&, CL_String8)]+0x53): undefined reference to `CL_StringRef8::~CL_StringRef8()'
    test.cpp:(.text._ZN10CL_Console10write_lineI10CL_String8EEvRK13CL_StringRef8T_[void CL_Console::write_line<CL_String8>(CL_StringRef8 const&, CL_String8)]+0x64): undefined reference to `CL_StringRef8::~CL_StringRef8()'
    test.cpp:(.text._ZN10CL_Console10write_lineI10CL_String8EEvRK13CL_StringRef8T_[void CL_Console::write_line<CL_String8>(CL_StringRef8 const&, CL_String8)]+0x75): undefined reference to `CL_StringFormat::get_result() const'
    test.cpp:(.text._ZN10CL_Console10write_lineI10CL_String8EEvRK13CL_StringRef8T_[void CL_Console::write_line<CL_String8>(CL_StringRef8 const&, CL_String8)]+0x84): undefined reference to `CL_String8::operator CL_StringRef8() const'
    test.cpp:(.text._ZN10CL_Console10write_lineI10CL_String8EEvRK13CL_StringRef8T_[void CL_Console::write_line<CL_String8>(CL_StringRef8 const&, CL_String8)]+0x9d): undefined reference to `CL_StringRef8::~CL_StringRef8()'
    test.cpp:(.text._ZN10CL_Console10write_lineI10CL_String8EEvRK13CL_StringRef8T_[void CL_Console::write_line<CL_String8>(CL_StringRef8 const&, CL_String8)]+0xae): undefined reference to `CL_StringRef8::~CL_StringRef8()'
    test.cpp:(.text._ZN10CL_Console10write_lineI10CL_String8EEvRK13CL_StringRef8T_[void CL_Console::write_line<CL_String8>(CL_StringRef8 const&, CL_String8)]+0xbf): undefined reference to `CL_StringFormat::~CL_StringFormat()'
    test.cpp:(.text._ZN10CL_Console10write_lineI10CL_String8EEvRK13CL_StringRef8T_[void CL_Console::write_line<CL_String8>(CL_StringRef8 const&, CL_String8)]+0xd8): undefined reference to `CL_StringFormat::~CL_StringFormat()'
    collect2: ld returned 1 exit status
    Must I use g++ test.cpp -l<library>? Or it is problem in bad installation of ClanLibrary?

    Can anybody help me? L.
    Last edited by lorin; 01-15-2011 at 08:01 PM.

Similar Threads

  1. Failure to compile on GNU
    By speeder in forum Official ClanLib SDK Forums
    Replies: 6
    Last Post: 07-29-2010, 10:53 PM
  2. After i compile it and run it on another computer
    By jerry in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 03-30-2010, 07:37 AM
  3. Can't compile clanGL on Mac
    By Tael_ in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 07-18-2008, 01:19 AM
  4. Can't compile application
    By Magus in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 02-26-2008, 07:51 AM
  5. how to compile static
    By andreaszdw in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 05-07-2007, 05:03 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
  •