ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Warning C4251

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
291 Views, 2 Replies

Warning C4251

Hi, Compiling my arx application using visual studio.NET (2002) I am having the folowing warning: c:\Arquivos de programas\Microsoft Visual Studio .NET\Vc7\include\vector(35) : warning C4251: 'std::_Vector_val<_Ty,_Alloc>::_Alval' : class 'std::allocator<_Ty>' needs to have dll-interface to be used by clients of class 'std::_Vector_val<_Ty,_Alloc>' with [ _Ty=CSgString, _Alloc=std::allocator ] and [ _Ty=CSgString ] and [ _Ty=CSgString, _Alloc=std::allocator ] c:\develop\sagre\7.0.1\components\Maps\win\components\common\sagre\inc\CSgString.h(39) : see reference to class template instantiation 'std::vector<_Ty,_Ax>' being compiled with [ _Ty=CSgString, _Ax=std::allocator ] I would like to know if it is a serious problem and how can I solve it. Best Regards, Aragao
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Hi, I forgot to put my code: #ifdef _SSAGREIMPEXP_ #define SSAGREDLLIMPEXP __declspec(dllexport) #define SSAGREEXTERN #else #define SSAGREDLLIMPEXP __declspec(dllimport) #define SSAGREEXTERN extern #endif SSAGREEXTERN template class SSAGREDLLIMPEXP std::vector< CSgString >; //Warning typedef std::vector CSgStringArray; CHeers, Aragao "Paulo Aragao" wrote in message news:4007cc16_3@statler... Hi, Compiling my arx application using visual studio.NET (2002) I am having the folowing warning: c:\Arquivos de programas\Microsoft Visual Studio .NET\Vc7\include\vector(35) : warning C4251: 'std::_Vector_val<_Ty,_Alloc>::_Alval' : class 'std::allocator<_Ty>' needs to have dll-interface to be used by clients of class 'std::_Vector_val<_Ty,_Alloc>' with [ _Ty=CSgString, _Alloc=std::allocator ] and [ _Ty=CSgString ] and [ _Ty=CSgString, _Alloc=std::allocator ] c:\develop\sagre\7.0.1\components\Maps\win\components\common\sagre\inc\CSgString.h(39) : see reference to class template instantiation 'std::vector<_Ty,_Ax>' being compiled with [ _Ty=CSgString, _Ax=std::allocator ] I would like to know if it is a serious problem and how can I solve it. Best Regards, Aragao
Message 3 of 3
Anonymous
in reply to: Anonymous

Paulo Aragao wrote: > Hi, > I forgot to put my code: > > #ifdef _SSAGREIMPEXP_ > #define SSAGREDLLIMPEXP __declspec(dllexport) > #define SSAGREEXTERN > #else > #define SSAGREDLLIMPEXP __declspec(dllimport) > #define SSAGREEXTERN extern > #endif > > SSAGREEXTERN template class SSAGREDLLIMPEXP std::vector< CSgString >; > //Warning > typedef std::vector CSgStringArray; Hi Paulo, std::vector is a template class, you can't export it. The correct usage is: typedef std::vector CSgStringArray; and include this statement where yo want to use it. The reason for the warning is the following: In the STL implementation that ships with VC 7 std::vector derives from _Vector_val. This class is not exported (it does not need to be, as it is again a template). Now the compiler tells you that you export a class (the vector) that is derived from another class that is not exported (_Vector_val). For non-template classes, this is very likely to cause trouble. But as said you dont't need to export/import template classes. HTH, Andy > > CHeers, > Aragao > > "Paulo Aragao" > > wrote in message news:4007cc16_3@statler... > Hi, > Compiling my arx application using visual studio.NET (2002) I am > having the folowing warning: > > c:\Arquivos de programas\Microsoft Visual Studio > .NET\Vc7\include\vector(35) : warning C4251: > 'std::_Vector_val<_Ty,_Alloc>::_Alval' : class 'std::allocator<_Ty>' > needs to have dll-interface to be used by clients of class > 'std::_Vector_val<_Ty,_Alloc>' > with > [ > _Ty=CSgString, > _Alloc=std::allocator > ] > and > [ > _Ty=CSgString > ] > and > [ > _Ty=CSgString, > _Alloc=std::allocator > ] > c:\develop\sagre\7.0.1\components\Maps\win\components\common\sagre\inc\CSgString.h(39) > : see reference to class template instantiation > 'std::vector<_Ty,_Ax>' being compiled > with > [ > _Ty=CSgString, > _Ax=std::allocator > ] > > I would like to know if it is a serious problem and how can I solve it. > > Best Regards, > Aragao

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost