Thread: Linking to STL Port Libraries failing

  1. #1
    Registered User
    Join Date
    Mar 2009

    Question Linking to STL Port Libraries failing

    After hours of googling and options testing I've broken down and decided to ask for help.

    I am trying to compile a test application for the STLPort libraries under MinGW and Msys.

    I successfully compiled STLPort with
    ./configure --without-stlport --enable-static --use-static-gcc
    CFLAGS / CXXFLAGS (set to same thing)
    $ echo $CFLAGS 
    -I/e/MinGW/include -I/e/Build/STLport-5.2.1/stlport -L/e/MinGW/lib -L/e/MinGW/lib/gcc/mingw32/4.5.0/
    I have made a basic main.cpp to test / try it out
    #include <iostream>
    using namespace std;
    int main (int argc, char * argv[])
      cout << "Hello World!" << endl;
    and am compiling with the command
    g++ -Wall -mthreads -I/usr/include/ -L/usr/local/lib/STLPort/ main.cpp -o main.exe -lstlport
    And an ls of the two directories
    $ ls /usr/include
    algorithm  climits  cstdio   errno.h      hash_set    iso646.h   locale.h  ostream        setjmp.h   stdio.h        strstream      using
    assert.h   clocale  cstdlib  exception    iomanip     istream    map       ostream.h      signal.h   stdiostream.h  strstream.h    utility
    bitset     cmath    cstring  exception.h  iomanip.h   istream.h  math.h    pthread.h      slist      stdlib.h       time.h         valarray
    cassert    complex  ctime    float.h      ios         iterator   mem.h     pthread_alloc  sstream    stl            type_traits    vector
    cctype     csetjmp  ctype.h  fstream      ios.h       limits     memory    queue          stack      streambuf      typeinfo       wchar.h
    cerrno     csignal  cwchar   fstream.h    iosfwd      limits.h   new       rlocks.h       stdarg.h   streambuf.h    typeinfo.h     wctype.h
    cfloat     cstdarg  cwctype  functional   iostream    list       new.h     rope           stddef.h   string         unordered_map
    ciso646    cstddef  deque    hash_map     iostream.h  locale     numeric   set            stdexcept  string.h       unordered_set
    $ ls /usr/local/lib/STLPort/
    allocators.o  collate.o       ctype.o          fstream.o   libstlport.5.2.dll    locale_impl.o  num_get_float.o  ostream.o          string.o
    bitset.o      complex.o       cxa.o            ios.o       libstlport.5.2.dll.a  messages.o     num_put.o        sstream.o          strstream.o
    c_locale.o    complex_io.o    dll_main.o       iostream.o  locale.o              monetary.o     num_put_float.o  stdio_streambuf.o  time_facets.o
    codecvt.o     complex_trig.o  facets_byname.o  istream.o   locale_catalog.o      num_get.o      numpunct.o       stlport.res
    when compiling I get the following output
    [DIR_TO_TEMP_OMMITED]\ccP5OPug.o:main.cpp:(.text+0xf): undefined reference to `_imp___ZN8stlp_std4coutE'
    [DIR_TO_TEMP_OMMITED]\ccP5OPug.o:main.cpp:(.text$_ZN8stlp_std8ios_base23_M_check_exception_maskEv[stlp_std::ios_base::_M_check_exception_mask()]+0x1f): undefined reference to `_imp___ZN8stlp_std8ios_base16_M_throw_failureEv'
    collect2: ld returned 1 exit status
    It seems to me like its not finding the 'included' library. What am I doing wrong here? I can compile w/o the STLPort libraries however MinGW (still) doesn't support unicode streams. I would really like said streams.

  2. #2
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    I have no idea.

    But shouldn't you give the compiler a lib file for STLPort?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  3. #3
    Registered User
    Join Date
    Mar 2009
    Yea, I did that. the
    added the path and the
    (now -lstlport.5.2 since new compilations) to link it to the libstlport.5.2.dll.a library. I'm pretty sure that I'm missing something basic here because an object dump of the libstlport.5.2.dll.a exports a header that matches the "undefined reference"

    I've posed the question in the STLPort forums. Feel free to mark this thread as closed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling GNU MP
    By mattnp12 in forum C Programming
    Replies: 3
    Last Post: 06-23-2011, 03:58 PM
  2. Comodo Firewall Vulnerability (Port 0)
    By Mario F. in forum Tech Board
    Replies: 0
    Last Post: 11-11-2009, 08:56 AM
  3. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  4. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  5. Help with linking to other c++ libraries via .net
    By pipercubusa in forum C++ Programming
    Replies: 0
    Last Post: 05-02-2005, 01:08 PM

Tags for this Thread