Results 1 to 8 of 8

Thread: error: ‘shared_ptr’ in namespace ‘std’ does not name a type

  1. #1

    Default error: ‘shared_ptr’ in namespace ‘std’ does not name a type

    I've just compiled & installed the ClanLib libraries onto my Linux Mint box & I've followed this tutorial:
    http://codegrind.net/2010/09/30/clan...tting-started/

    But when I compile it (I use Netbeans 6.9) I get a LONG list of error messages that mostly contain this line (or variations of it with other ClanLib files):
    Code:
    from main.cpp:1:
    In file included from /usr/local/include/ClanLib/core.h:69:0,
    /usr/local/include/ClanLib/Core/Text/string_allocator.h:134:2: error: ‘shared_ptr’ in namespace ‘std’ does not name a type
    Any ideas what's going wrong? Apart from shared_ptr not having a type.

    If you want the full build list/log thing, let me know & I'll post it.

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

    Default

    Your gcc is not compiling C++11

    I guess "-std=c++0x " is missing from the makefile

  3. #3

    Default

    I don't know much about makefiles (only what they do), so I don't know where to add -std=c++0x in it, so I added itt to the Additional Options under C++ compiler for the project & now I'm getting a different error (excuse the length):

    Code:
    "/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-confmake[1]: Entering directory `/home/matt/NetBeansProjects/Test Orx'
    "/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/test_orx
    make[2]: Entering directory `/home/matt/NetBeansProjects/Test Orx'
    mkdir -p dist/Debug/GNU-Linux-x86
    g++ -std=c++0x    -o dist/Debug/GNU-Linux-x86/test_orx build/Debug/GNU-Linux-x86/main.o  
    make[2]: Leaving directory `/home/matt/NetBeansProjects/Test Orx'
    make[1]: Leaving directory `/home/matt/NetBeansProjects/Test Orx'
    /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../crt1.o: In function `_start':
    build/Debug/GNU-Linux-x86/main.o: In function `CL_Console::write_line(CL_StringRef8 const&)':
    /usr/local/include/ClanLib/Core/Text/console.h:198: undefined reference to `CL_Console::write(CL_StringRef8 const&)'
    /usr/local/include/ClanLib/Core/Text/console.h:202: undefined reference to `CL_StringRef8::CL_StringRef8(char const*)'
    /usr/local/include/ClanLib/Core/Text/console.h:202: undefined reference to `CL_Console::write(CL_StringRef8 const&)'
    /usr/local/include/ClanLib/Core/Text/console.h:202: undefined reference to `CL_StringRef8::~CL_StringRef8()'
    /usr/local/include/ClanLib/Core/Text/console.h:202: undefined reference to `CL_StringRef8::~CL_StringRef8()'
    build/Debug/GNU-Linux-x86/main.o: In function `CL_ClanApplication':
    /usr/local/include/ClanLib/App/clanapp.h:65: undefined reference to `CL_ClanApplication::main'
    build/Debug/GNU-Linux-x86/main.o: In function `ConsoleProgram::main(std::vector<CL_String8, std::allocator<CL_String8> > const&)':
    /home/matt/NetBeansProjects/Test Orx/main.cpp:7: undefined reference to `CL_SetupCore::CL_SetupCore()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:8: undefined reference to `CL_StringRef8::CL_StringRef8(char const*)'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:8: undefined reference to `CL_ConsoleWindow::CL_ConsoleWindow(CL_StringRef8 const&, int, int)'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:8: undefined reference to `CL_StringRef8::~CL_StringRef8()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:10: undefined reference to `CL_DateTime::get_current_local_time()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:10: undefined reference to `CL_DateTime::to_short_datetime_string() const'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:10: undefined reference to `CL_DateTime::~CL_DateTime()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:12: undefined reference to `CL_String8::CL_String8(CL_String8 const&)'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:12: undefined reference to `CL_StringRef8::CL_StringRef8(char const*)'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:12: undefined reference to `CL_StringRef8::~CL_StringRef8()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:12: undefined reference to `CL_String8::~CL_String8()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:13: undefined reference to `CL_Console::wait_for_key()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:10: undefined reference to `CL_String8::~CL_String8()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:8: undefined reference to `CL_ConsoleWindow::~CL_ConsoleWindow()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:7: undefined reference to `CL_SetupCore::~CL_SetupCore()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:8: undefined reference to `CL_StringRef8::~CL_StringRef8()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:10: undefined reference to `CL_DateTime::~CL_DateTime()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:12: undefined reference to `CL_StringRef8::~CL_StringRef8()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:12: undefined reference to `CL_String8::~CL_String8()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:10: undefined reference to `CL_String8::~CL_String8()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:8: undefined reference to `CL_ConsoleWindow::~CL_ConsoleWindow()'
    /home/matt/NetBeansProjects/Test Orx/main.cpp:7: undefined reference to `CL_SetupCore::~CL_SetupCore()'
    build/Debug/GNU-Linux-x86/main.o: In function `void CL_Console::write_line<CL_String8>(CL_StringRef8 const&, CL_String8)':
    /usr/local/include/ClanLib/Core/Text/console.h:214: undefined reference to `CL_StringFormat::CL_StringFormat(CL_StringRef8 const&)'
    /usr/local/include/ClanLib/Core/Text/console.h:215: undefined reference to `CL_String8::operator CL_StringRef8() const'
    /usr/local/include/ClanLib/Core/Text/console.h:215: undefined reference to `CL_StringFormat::set_arg(int, CL_StringRef8 const&)'
    /usr/local/include/ClanLib/Core/Text/console.h:215: undefined reference to `CL_StringRef8::~CL_StringRef8()'
    /usr/local/include/ClanLib/Core/Text/console.h:216: undefined reference to `CL_StringFormat::get_result() const'
    /usr/local/include/ClanLib/Core/Text/console.h:216: undefined reference to `CL_String8::operator CL_StringRef8() const'
    /usr/local/include/ClanLib/Core/Text/console.h:216: undefined reference to `CL_StringRef8::~CL_StringRef8()'
    /usr/local/include/ClanLib/Core/Text/console.h:214: undefined reference to `CL_StringFormat::~CL_StringFormat()'
    /usr/local/include/ClanLib/Core/Text/console.h:215: undefined reference to `CL_StringRef8::~CL_StringRef8()'
    /usr/local/include/ClanLib/Core/Text/console.h:216: undefined reference to `CL_StringRef8::~CL_StringRef8()'
    /usr/local/include/ClanLib/Core/Text/console.h:214: undefined reference to `CL_StringFormat::~CL_StringFormat()'
    collect2: ld returned 1 exit status
    make[2]: *** [dist/Debug/GNU-Linux-x86/test_orx] Error 1
    make[1]: *** [.build-conf] Error 2
    make: *** [.build-impl] Error 2
    
    
    BUILD FAILED (exit value 2, total time: 387ms)

  4. #4
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    This time it is because you're not linking with the ClanLib library files (all libclanCore functions listed in that output).

  5. #5

    Default

    You mean the #include lines?

    If so, I've got these two:

    Code:
    #include <ClanLib/core.h>
    #include <ClanLib/application.h>
    (I'm new to C++ so you'll have to be patient with me, sorry)

  6. #6

    Default

    Not the header he meant the actual library (.lib or .o depending). Unfortunately i never really messed with makefile so I can't really tell you where to link the library, in an IDE like code blocks there is a place in settings where you can add the name of the library to link. But i guess a quick google search could help you figure out what to add to the makefile.

    edit: you may want to look at this site http://www.sethi.org/classes/cet375/...mpilation.html
    it provide makefile example and explanation for all section of the makefiles. I'm not sure about how updated it is thought.

  7. #7

    Default

    EDIT:

    I've added the libclan23App.a & libclan23Core.a & now I'm getting this:

    Code:
    "/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
    make[1]: Entering directory `/home/matt/NetBeansProjects/Test Orx'
    "/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/test_orx
    make[2]: Entering directory `/home/matt/NetBeansProjects/Test Orx'
    mkdir -p dist/Debug/GNU-Linux-x86
    g++ -std=c++0x    -o dist/Debug/GNU-Linux-x86/test_orx build/Debug/GNU-Linux-x86/main.o /usr/local/lib/libclan23App.a /usr/local/lib/libclan23Core.a 
    make[2]: Leaving directory `/home/matt/NetBeansProjects/Test Orx'
    make[1]: Leaving directory `/home/matt/NetBeansProjects/Test Orx'
    /usr/local/lib/libclan23Core.a(libclan23Core_la-mutex.o): In function `CL_Mutex::try_lock()':
    /home/matt/ClanLib-2.3.3/Sources/Core/System/mutex.cpp:101: undefined reference to `pthread_mutex_trylock'
    /usr/local/lib/libclan23Core.a(libclan23Core_la-mutex.o): In function `CL_Mutex':
    /home/matt/ClanLib-2.3.3/Sources/Core/System/mutex.cpp:55: undefined reference to `pthread_mutexattr_init'
    /home/matt/ClanLib-2.3.3/Sources/Core/System/mutex.cpp:62: undefined reference to `pthread_mutexattr_setkind_np'
    /home/matt/ClanLib-2.3.3/Sources/Core/System/mutex.cpp:66: undefined reference to `pthread_mutexattr_destroy'
    collect2: ld returned 1 exit status
    make[2]: *** [dist/Debug/GNU-Linux-x86/test_orx] Error 1
    make[1]: *** [.build-conf] Error 2
    make: *** [.build-impl] Error 2
    
    BUILD FAILED (exit value 2, total time: 1s)
    Last edited by Matt-SD; 09-29-2011 at 03:10 AM.

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

    Default

    If you see the section Using ClanLib at http://clanlib.org/wiki/MainDocs:GNU_C%2B%2B_on_Linux
    You see that you require to libk against pthread as well: -lpthread


    Quote Originally Posted by Matt-SD View Post
    EDIT:

    I've added the libclan23App.a & libclan23Core.a & now I'm getting this:

    Code:
    "/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
    make[1]: Entering directory `/home/matt/NetBeansProjects/Test Orx'
    "/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/test_orx
    make[2]: Entering directory `/home/matt/NetBeansProjects/Test Orx'
    mkdir -p dist/Debug/GNU-Linux-x86
    g++ -std=c++0x    -o dist/Debug/GNU-Linux-x86/test_orx build/Debug/GNU-Linux-x86/main.o /usr/local/lib/libclan23App.a /usr/local/lib/libclan23Core.a 
    make[2]: Leaving directory `/home/matt/NetBeansProjects/Test Orx'
    make[1]: Leaving directory `/home/matt/NetBeansProjects/Test Orx'
    /usr/local/lib/libclan23Core.a(libclan23Core_la-mutex.o): In function `CL_Mutex::try_lock()':
    /home/matt/ClanLib-2.3.3/Sources/Core/System/mutex.cpp:101: undefined reference to `pthread_mutex_trylock'
    /usr/local/lib/libclan23Core.a(libclan23Core_la-mutex.o): In function `CL_Mutex':
    /home/matt/ClanLib-2.3.3/Sources/Core/System/mutex.cpp:55: undefined reference to `pthread_mutexattr_init'
    /home/matt/ClanLib-2.3.3/Sources/Core/System/mutex.cpp:62: undefined reference to `pthread_mutexattr_setkind_np'
    /home/matt/ClanLib-2.3.3/Sources/Core/System/mutex.cpp:66: undefined reference to `pthread_mutexattr_destroy'
    collect2: ld returned 1 exit status
    make[2]: *** [dist/Debug/GNU-Linux-x86/test_orx] Error 1
    make[1]: *** [.build-conf] Error 2
    make: *** [.build-impl] Error 2
    
    BUILD FAILED (exit value 2, total time: 1s)

Similar Threads

  1. Get the type of input
    By JoseMan in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 09-06-2010, 06:51 AM
  2. What I would need to do to implement a new entity type or something?
    By speeder in forum Novashell Game Creation System
    Replies: 1
    Last Post: 08-18-2010, 05:10 AM
  3. CL_ProviderFactory: Unknown image provider type png
    By The User in forum Official ClanLib SDK Forums
    Replies: 9
    Last Post: 02-05-2010, 01:33 PM
  4. Replies: 5
    Last Post: 07-06-2009, 01:35 PM
  5. A Castlevania/Metroid type game
    By illspirit in forum Novashell Game Creation System
    Replies: 20
    Last Post: 01-27-2009, 11:14 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
  •