Skip to main content
gamedev.net
🔒 Locked

STL vecotstring problem !

Started by sepul 1 reply 500+ views
Original Post
sepul
sepul
I've recently updated my code with Stlport library, but this code snippet doesn't seem to work

#include "stdafx.h"
#include <string>
#include <vector>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	string text("add me");
	vector<string> strList;
	strList.push_back( text );
	return 0;
}
compiling this code generates this error :

c:\Program Files\Microsoft Visual Studio .NET 2003\STLport-4.6.2\stlport\stl\_list.h(243) : error C2668: 'std::_Construct' : ambiguous call to overloaded function
        c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xmemory(40): could be 'void std::_Construct<_Tp,_Tp>(_T1 *,const _T2 &)' [found using argument-dependent lookup]
        with
        [
            _Tp=_STL::string,
            _T1=_STL::string,
            _T2=_STL::string
        ]
        c:\Program Files\Microsoft Visual Studio .NET 2003\STLport-4.6.2\stlport\stl\_construct.h(93): or       'void _STL::_Construct<_Tp,_Tp>(_T1 *,const _T2 &)'
        with
        [
            _Tp=_STL::string,
            _T1=_STL::string,
            _T2=_STL::string
        ]
        while trying to match the argument list '(_STL::string *__w64 , const _STL::string)'
        c:\Program Files\Microsoft Visual Studio .NET 2003\STLport-4.6.2\stlport\stl\_list.h(240) : while compiling class-template member function '_STL::list<_Tp>::_Node *_STL::list<_Tp>::_M_create_node(const _Tp &)'
        with
        [
            _Tp=_STL::string
        ]
        d:\Sepul\Dev\stltest\stltest.cpp(13) : see reference to class template instantiation '_STL::list<_Tp>' being compiled
        with
        [
            _Tp=_STL::string
        ]
this error only occurs on vector<string>
JohnBolton
JohnBolton
Quote:

...\Vc7\include\xmemory(40): could be 'void std::_Construct<_Tp,_Tp>(_T1 *,const _T2 &)
...\STLport-4.6.2\stlport\stl\_construct.h(93): or 'void _STL::_Construct<_Tp,_Tp>(_T1 *,const _T2 &)


Could it be that you are mixing the compiler's version of STL with stlport?
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
sepul
sepul
I guess I am
how can I get rid of the old stl in vc ?
I'm already putting stlport include directory first, is there anything else I have to do ?

the point is, I'm using no IO-stream version of stlport, so I think maybe stl includes <string> from the default vc lib, instead of itself.

[Edited by - sepul on October 26, 2005 3:49:19 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.