Author Topic: MinGW with STLport  (Read 10676 times)

Offline alifehpp

  • Single posting newcomer
  • *
  • Posts: 5
MinGW with STLport
« on: February 03, 2007, 12:20:42 pm »
I have problem using Code::Blocks with Mingw and STLport. A "hello, world" project doesn't link.
I try different settings of C::B but i have a linker errors
There is a code:
Code
#include <vector>
#include <string>
#include <iostream>
int main()
{
std::vector<std::string> vec;
vec.push_back("hello cb");
std::cout << vec[0];
        return 0;
}
there are errors:
Code
F:/stlport/stlport/stl/_move_construct_fwk.h:104: undefined reference to `_imp___ZN11stlpmtx_std4coutE'
F:/stlport/stlport/stl/_move_construct_fwk.h:104: undefined reference to `_imp___ZN11stlpmtx_std12__node_alloc13_M_deallocateEPvj'
F:/stlport/stlport/stl/_move_construct_fwk.h:104: undefined reference to `_imp___ZN11stlpmtx_std8ios_base16_M_throw_failureEv'
F:/stlport/stlport/stl/_move_construct_fwk.h:104: undefined reference to `_imp___ZN11stlpmtx_std24__stl_throw_length_errorEPKc'
F:/stlport/stlport/stl/_move_construct_fwk.h:104: undefined reference to `_imp___ZN11stlpmtx_std12__node_alloc11_M_allocateERj'
collect2: ld returned 1 exit status
I have Mingw 3.4.5, C::b rev 3558 (31.01) and STLPort 5.1.0
P.S. Sorry for my English.

Offline wxLearner

  • Multiple posting newcomer
  • *
  • Posts: 71
Re: MinGW with STLport
« Reply #1 on: February 03, 2007, 01:27:12 pm »
  • link with the STLport library
  • use multithreading by specifying -mthreads in "Build options => Compiler/Linker => Other Options"
  • don't forget, that if you use multithreading, your executable needs the mingwm10.dll, that is in your MinGW bin directory

Offline alifehpp

  • Single posting newcomer
  • *
  • Posts: 5
Re: MinGW with STLport
« Reply #2 on: February 03, 2007, 03:39:51 pm »
Thank you very much, but solve this problem myself. But i have another question, does gcc support auto link?

Offline alifehpp

  • Single posting newcomer
  • *
  • Posts: 5
Re: MinGW with STLport
« Reply #3 on: February 03, 2007, 07:22:24 pm »
I have downloaded new C::B build and application witch build within STLport fails with runtime error. SIGSEGV, Segmentation fault, what it means and how fix it?

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: MinGW with STLport
« Reply #4 on: February 03, 2007, 07:58:43 pm »
SIGSEGV, Segmentation fault, what it means and how fix it?

Hello,

May be this website could help you:

http://en.wikipedia.org/wiki/Segmentation_fault

Also search with google for e.g., "SIGSEGV, Segmentation fault". You should find helpful information :).

Best wishes,
Michael

Offline alifehpp

  • Single posting newcomer
  • *
  • Posts: 5
Re: MinGW with STLport
« Reply #5 on: February 03, 2007, 09:52:35 pm »
Thank you, under Visual Studio it called access violation. But why STLport fails under MinGW and not under VS8?
If not use iostreams, all works perfectly. I wonder.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2290
Re: MinGW with STLport
« Reply #6 on: February 03, 2007, 10:05:28 pm »
Thank you, under Visual Studio it called access violation. But why STLport fails under MinGW and not under VS8?
If not use iostreams, all works perfectly. I wonder.

Just my two cents worth. Reading or Writing to an unopened file can cause all sorts of faults.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: MinGW with STLport
« Reply #7 on: February 04, 2007, 08:37:24 pm »
Thank you, under Visual Studio it called access violation. But why STLport fails under MinGW and not under VS8?
If not use iostreams, all works perfectly. I wonder.

Hello,

GCC and VS8 C++ are two different compilers more or less ISO C++ compliant.

Regarding your problem, did you check that everything is installed correctly (MinGW+binutil+win api, C::B, etc.)? Did you set the path to every include file and library in C::B?

You can try with a newer C::B revision...

Also give a try to a google search with "MinGW with STL Port". With a bit of luck, you should get helpful info.

Best wishes,
Michael

Online stahta01

  • Lives here!
  • ****
  • Posts: 7091
    • My Best Post
Re: MinGW with STLport
« Reply #8 on: February 04, 2007, 10:25:46 pm »
Did you copy the STL DLLs to the project folder that contains the exe?

Tim S
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online stahta01

  • Lives here!
  • ****
  • Posts: 7091
    • My Best Post
Re: MinGW with STLport
« Reply #9 on: February 04, 2007, 11:29:30 pm »
Your test hello world worked for me with STLport STLport-5.0.3, note it did need the DLL for libstlport.5.0.dll to work. Below is my compile commands.
Note, the readme stated that STLport includes must before the normal includes.

-------------- Build: Release in helloworld ---------------
mingw32-g++.exe -Wall -O2  -mthreads  -IC:\apps\MinGW_GCC_3.4.5_API_3_8_STLport\STLport\stlport -IC:\apps\MinGW_GCC_3.4.5_API_3_8_STLport\include  -c C:\CodeProjects\CodeBlocksProjects\CodeBlocks\CB_SVN_TEST\codeblocks-head-test\codeblocks\src\tests\STLport\helloworld\helloworld.cpp -o obj\Release\helloworld.o
C:/apps/MinGW_GCC_3.4.5_API_3_8_STLport/STLport/stlport/stl/_uninitialized.h: In member function `void stlp_std::vector<_Tp, _Alloc>::_M_insert_overflow_aux(_Tp*, const _Tp&, const stlp_std::__false_type&, size_t, bool) [with _Tp = stlp_std::string, _Alloc = stlp_std::allocator<stlp_std::string>]':
C:/apps/MinGW_GCC_3.4.5_API_3_8_STLport/STLport/stlport/stl/_uninitialized.h:239: warning: '__cur' might be used uninitialized in this function
mingw32-g++.exe -LC:\apps\MinGW_GCC_3.4.5_API_3_8_STLport\STLport\lib -LC:\apps\MinGW_GCC_3.4.5_API_3_8_STLport\lib  -o bin\Release\helloworld.exe obj\Release\helloworld.o   -s  -lstlport.5.0.dll
Info: resolving stlp_std::cout      by linking to __imp___ZN8stlp_std4coutE (auto-import)
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 1 warnings
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online stahta01

  • Lives here!
  • ****
  • Posts: 7091
    • My Best Post
Re: MinGW with STLport
« Reply #10 on: February 04, 2007, 11:48:18 pm »
Installed STLport-5.1.0 and it also worked.
Tim S

-------------- Build: Release in helloworld ---------------
mingw32-g++.exe -Wall -O2  -mthreads  -IC:\apps\MinGW_GCC_3.4.5_API_3_8_STLport\STLport-5.1.0\stlport -IC:\apps\MinGW_GCC_3.4.5_API_3_8_STLport\include  -c C:\CodeProjects\CodeBlocksProjects\CodeBlocks\CB_SVN_TEST\codeblocks-head-test\codeblocks\src\tests\STLport\helloworld\helloworld.cpp -o obj\Release\helloworld.o
C:/apps/MinGW_GCC_3.4.5_API_3_8_STLport/STLport-5.1.0/stlport/stl/_uninitialized.h: In member function `void stlp_std::vector<_Tp, _Alloc>::_M_insert_overflow_aux(_Tp*, const _Tp&, const stlp_std::__false_type&, size_t, bool) [with _Tp = stlp_std::string, _Alloc = stlp_std::allocator<stlp_std::string>]':
C:/apps/MinGW_GCC_3.4.5_API_3_8_STLport/STLport-5.1.0/stlport/stl/_uninitialized.h:247: warning: '__cur' might be used uninitialized in this function
mingw32-g++.exe -LC:\apps\MinGW_GCC_3.4.5_API_3_8_STLport\STLport-5.1.0\lib -LC:\apps\MinGW_GCC_3.4.5_API_3_8_STLport\lib  -o bin\Release\helloworld.exe obj\Release\helloworld.o   -s  -lstlport.5.1.dll
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 1 warnings
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online stahta01

  • Lives here!
  • ****
  • Posts: 7091
    • My Best Post
Re: MinGW with STLport
« Reply #11 on: February 04, 2007, 11:51:06 pm »
I used MSys to build the libs and I used the commands below to compile the libs.

From the README file steps for GNU Make (Linux, OpenBSD, FreeBSD, CygWin, etc.), with gcc:

    make -f gcc.mak depend
    make -f gcc.mak install


Note, STLport-5.0.3 seems to work better than STLport-5.1.0.
« Last Edit: February 05, 2007, 01:29:42 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org