PDA

View Full Version : vector / c++ / visual c++ 5.0



02-12-2004, 04:11 AM
Please, help me...it's many weeks I can't solve my problem. In the most of 3ds loaders I found, there's the use of the class "vector" using "push back" and the other function I don't remember now. well, this class doesn't work with all compilers I got.I know I could write my own code, but I can't. please, is there anyone who could help me? thanks very much!
Fabio

matticus
02-12-2004, 04:20 AM
Vector is in the STL, so it should be available on every C++ compiler.
Try including it's header in angle brackets like this:

#include <vector>

And check that everywhere you use vector, make sure that you are in the correct namespace. i.e.
where ever you see:

vector<int> my_vec;

change it to:

std::vector<int> my_vec;

Hope this helps.

zeckensack
02-12-2004, 05:37 AM
If your "problem code" uses just vector <float> or something, there will be problems with ISO compliant C++ compilers. Yes, you can change it to std::vector <float> everywhere, but an easier way is to just add


using namespace std;immediately after the #include <vector> directive.

02-16-2004, 12:53 AM
well, I use "using namespace std;" cause it's already present in the code, but the problem remains. this is what happens when I compile it, so you can have a more specific help.
--------------------Configuration: 3dsLoader - Win32 Debug--------------------
Compiling...
3dsLoader.cpp
C:\Programmi\DevStudio\VC\INCLUDE\xutility(45) : error C2784: 'bool __cdecl std: http://www.opengl.org/discussion_boards/ubb/redface.gifperator <(const class std::reverse_iterator<`template-parameter-1',`template-parameter-2',`template-parameter-3',`template-parameter-4',`template-parameter-5'> &,const
class std::reverse_iterator<`template-parameter-1',`template-parameter-2',`template-parameter-3',`template-parameter-4',`template-parameter-5'> &)' : could not deduce template argument for 'const class std::reverse_iterator<`template-parameter-1',`
template-parameter-2',`template-parameter-3',`template-parameter-4',`template-parameter-5'> &' from 'const struct tMaterialInfo'
C:\Programmi\DevStudio\VC\INCLUDE\xutility(45) : error C2784: 'bool __cdecl std: http://www.opengl.org/discussion_boards/ubb/redface.gifperator <(const struct std: http://www.opengl.org/discussion_boards/ubb/tongue.gifair<`template-parameter-1',`template-parameter-2'> &,const struct std: http://www.opengl.org/discussion_boards/ubb/tongue.gifair<`template-parameter-1',`template-parameter-2'> &)' : could not
deduce template argument for 'const struct std: http://www.opengl.org/discussion_boards/ubb/tongue.gifair<`template-parameter-1',`template-parameter-2'> &' from 'const struct tMaterialInfo'
C:\Programmi\DevStudio\VC\INCLUDE\xutility(45) : error C2676: binary '<' : 'const struct tMaterialInfo' does not define this operator or a conversion to a type acceptable to the predefined operator
C:\Programmi\DevStudio\VC\INCLUDE\xutility(47) : error C2784: 'bool __cdecl std: http://www.opengl.org/discussion_boards/ubb/redface.gifperator <(const class std::reverse_iterator<`template-parameter-1',`template-parameter-2',`template-parameter-3',`template-parameter-4',`template-parameter-5'> &,const
class std::reverse_iterator<`template-parameter-1',`template-parameter-2',`template-parameter-3',`template-parameter-4',`template-parameter-5'> &)' : could not deduce template argument for 'const class std::reverse_iterator<`template-parameter-1',`
template-parameter-2',`template-parameter-3',`template-parameter-4',`template-parameter-5'> &' from 'const struct tMaterialInfo'
C:\Programmi\DevStudio\VC\INCLUDE\xutility(47) : error C2784: 'bool __cdecl std: http://www.opengl.org/discussion_boards/ubb/redface.gifperator <(const struct std: http://www.opengl.org/discussion_boards/ubb/tongue.gifair<`template-parameter-1',`template-parameter-2'> &,const struct std: http://www.opengl.org/discussion_boards/ubb/tongue.gifair<`template-parameter-1',`template-parameter-2'> &)' : could not
deduce template argument for 'const struct std: http://www.opengl.org/discussion_boards/ubb/tongue.gifair<`template-parameter-1',`template-parameter-2'> &' from 'const struct tMaterialInfo'
C:\Programmi\DevStudio\VC\INCLUDE\xutility(47) : error C2676: binary '<' : 'const struct tMaterialInfo' does not define this operator or a conversion to a type acceptable to the predefined operator
C:\Programmi\DevStudio\VC\INCLUDE\xutility(45) : error C2784: 'bool __cdecl std: http://www.opengl.org/discussion_boards/ubb/redface.gifperator <(const class std::reverse_iterator<`template-parameter-1',`template-parameter-2',`template-parameter-3',`template-parameter-4',`template-parameter-5'> &,const
class std::reverse_iterator<`template-parameter-1',`template-parameter-2',`template-parameter-3',`template-parameter-4',`template-parameter-5'> &)' : could not deduce template argument for 'const class std::reverse_iterator<`template-parameter-1',`
template-parameter-2',`template-parameter-3',`template-parameter-4',`template-parameter-5'> &' from 'const struct t3DObject'
C:\Programmi\DevStudio\VC\INCLUDE\xutility(45) : error C2784: 'bool __cdecl std: http://www.opengl.org/discussion_boards/ubb/redface.gifperator <(const struct std: http://www.opengl.org/discussion_boards/ubb/tongue.gifair<`template-parameter-1',`template-parameter-2'> &,const struct std: http://www.opengl.org/discussion_boards/ubb/tongue.gifair<`template-parameter-1',`template-parameter-2'> &)' : could not
deduce template argument for 'const struct std: http://www.opengl.org/discussion_boards/ubb/tongue.gifair<`template-parameter-1',`template-parameter-2'> &' from 'const struct t3DObject'
C:\Programmi\DevStudio\VC\INCLUDE\xutility(45) : error C2676: binary '<' : 'const struct t3DObject' does not define this operator or a conversion to a type acceptable to the predefined operator
C:\Programmi\DevStudio\VC\INCLUDE\xutility(47) : error C2784: 'bool __cdecl std: http://www.opengl.org/discussion_boards/ubb/redface.gifperator <(const class std::reverse_iterator<`template-parameter-1',`template-parameter-2',`template-parameter-3',`template-parameter-4',`template-parameter-5'> &,const
class std::reverse_iterator<`template-parameter-1',`template-parameter-2',`template-parameter-3',`template-parameter-4',`template-parameter-5'> &)' : could not deduce template argument for 'const class std::reverse_iterator<`template-parameter-1',`
template-parameter-2',`template-parameter-3',`template-parameter-4',`template-parameter-5'> &' from 'const struct t3DObject'
C:\Programmi\DevStudio\VC\INCLUDE\xutility(47) : error C2784: 'bool __cdecl std: http://www.opengl.org/discussion_boards/ubb/redface.gifperator <(const struct std: http://www.opengl.org/discussion_boards/ubb/tongue.gifair<`template-parameter-1',`template-parameter-2'> &,const struct std: http://www.opengl.org/discussion_boards/ubb/tongue.gifair<`template-parameter-1',`template-parameter-2'> &)' : could not
deduce template argument for 'const struct std: http://www.opengl.org/discussion_boards/ubb/tongue.gifair<`template-parameter-1',`template-parameter-2'> &' from 'const struct t3DObject'
C:\Programmi\DevStudio\VC\INCLUDE\xutility(47) : error C2676: binary '<' : 'const struct t3DObject' does not define this operator or a conversion to a type acceptable to the predefined operator
Error executing cl.exe.

3dsLoader.exe - 12 error(s), 0 warning(s)

where's the problem? thanks!

02-17-2004, 06:34 AM
it's always me. is there no one who can help me?

Honk
02-17-2004, 06:43 AM
I think this page maybe usefull to you:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;166721

02-19-2004, 04:30 AM
Now it's all ok, thanks!