Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: zyd on February 06, 2007, 04:44:37 am

Title: How to use STLPort510 ?
Post by: zyd on February 06, 2007, 04:44:37 am
I use codeblocks+mingw32+STLPort510, OS is Win2000. STLPort510 at: C:\STLPort510

My command for compiling STLPort510:
configure -c gcc
mingw32-make -f gcc.mak clean all
mingw32-make -f gcc.mak install

In my codeblocks, I do this: settings-->complier and debugger-->Search directoryis:
"Compiler":add "C:\STLPort510\stlport",
"Linker": add "C:\STLPort510\lib",
"Resource compiler": add "C:\STLPort510\stlport",
and all is before MinGW's directory.

Now, in my project, my code is:
//================================
#include <iostream>

int main()
{
   char sz[] = "ab";
   std::cout<< sz<< std::endl;
   return 0;
}
//================================
but, get errors, :
//===================================================================
//error location, from c:\STLPort510\stlport\stl\file _ios.h

public:                         // Members from clause 27.4.4.2
  basic_ostream<_CharT, _Traits>* tie() const {
    return _M_tied_ostream;
  }
//===================================================================

:: === Unicode, Debug ===
C:\STLPort5.1.0\stlport\stl\_ios.h:62: undefined reference to `_imp___ZN11stlpmtx_std4coutE'
C:\STLPort5.1.0\stlport\stl\_ios.h:62: undefined reference to `_imp___ZN11stlpmtx_std8ios_base16_M_throw_failureEv'
:: === Build finished: 2 errors, 0 warnings ===

-------------- Build: Debug in Unicode ---------------
mingw32-g++.exe -Wall -g  -IC:\STLPort5.1.0\stlport -IC:\MinGW\include  -c C:\Temp\CB\Unicode\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LC:\STLPort5.1.0\lib -LC:\MinGW\lib  -o .\Unicode.exe obj\Debug\main.o   
obj\Debug\main.o: In function `ZNK11stlpmtx_std9basic_iosIcNS_11char_traitsIcEEE3tieEv':
C:/STLPort5.1.0/stlport/stl/_ios.h:62: undefined reference to `_imp___ZN11stlpmtx_std4coutE'
C:/STLPort5.1.0/stlport/stl/_ios.h:62: undefined reference to `_imp___ZN11stlpmtx_std8ios_base16_M_throw_failureEv'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 2 seconds)
2 errors, 0 warnings


How I do? Help me.
Title: Re: How to use STLPort510 ?
Post by: zyd on February 06, 2007, 04:51:25 am
By the way, STLPort510 need Multithread support, but how to do it in codeblocks ?
Title: Re: How to use STLPort510 ?
Post by: stahta01 on February 06, 2007, 04:58:23 am
I think it is -mthreads added to compiler others options.

Tim S
Title: Re: How to use STLPort510 ?
Post by: zyd on February 06, 2007, 05:35:32 am
Yeah, I'm successful. 3ku stahta01.

But now, I have new question:
how to output widechar , I mean that like Chinese charactor, not English charactor.
This is my code:
//==========================
#include <iostream>

int main()
{
   std::wcout << L"中国" << std::endl;
   return 0;
}
//==========================
Error info like this:
C:\Temp\CB\Unicode\main.cpp:7: converting to execution character set: Illegal byte sequence
:: === 生成结束: 1个错误, 0个警告 ===
Title: Re: How to use STLPort510 ?
Post by: stahta01 on February 06, 2007, 05:56:35 am
What format is your cpp file in? I suggest UTF-8 as the best one to try at first.
It runs for me in-side of codeblocks but it only displays ab.
I have no idea if this is correct since I have no idea on how to make a dos window display another language.
Tim S
Title: Re: How to use STLPort510 ?
Post by: zyd on February 06, 2007, 06:28:43 am
But How to set cpp file to utf-8 formmat ? :(
Title: Re: How to use STLPort510 ?
Post by: zyd on February 06, 2007, 06:33:28 am
resolved!
settings-->editor.
3ks very much, stahta01 .
Title: Re: How to use STLPort510 ?
Post by: holmescn on April 05, 2007, 09:36:47 am
Why I can't successed.I have follow you!But the Error is still there!
Title: Re: How to use STLPort510 ?
Post by: holmescn on April 05, 2007, 09:44:29 am
My simple code is:
#include <iostream>

using namespace std;

int main()
{
   cout << "Hello world!" << endl;
   return 0;
}

stlport 5.1
mingw32 3.4.5
codeblocks recent nightlybuild
Title: Re: How to use STLPort510 ?
Post by: holmescn on April 05, 2007, 09:45:57 am
two more errors
obj\Debug\main.o:main.cpp:(.text+0x33): undefined reference to `_imp___ZN8stlp_std4coutE'
obj\Debug\main.o:main.cpp:(.text$_ZN8stlp_std8ios_base23_M_check_exception_maskEv[stlp_std::ios_base::_M_check_exception_mask()]+0x1d): undefined reference to `_imp___ZN8stlp_std8ios_base16_M_throw_failureEv'
Title: Re: How to use STLPort510 ?
Post by: holmescn on April 06, 2007, 11:01:03 am
I have resolved it
i add the  three .a file to the link option
the i got it