Game Development Community

Compiling tools under MSVC++ 7.0

by Jason Elison · in Torque Game Engine · 06/14/2002 (10:26 am) · 21 replies

I am using the MSVC++ 7.0 (.Net) compiler. Most of it compiles fine, a few warnings but nothing major, mostly signed/unsigned comparisons. Four of the projects will not compile successfully, however. They are the three Max exporters and the Milkshape exporter. The 3DS Max exporters all complain about a missing header file (ctl3d.h). I am assumming there is a .Net version of this header (since it is the header for 3D common controls), but I haven't looked for it since I don't have 3DS Max anyways. The Milkshape exporter has more problems. In DTSShape.cpp, around line 450, there is the following code...

std::string::const_iterator pos = mat->name.begin() ;
     while (pos != mat->name.end())
            out.write (pos++, 1) ;

It dies with the following error message, saying it cannot convert pos++ to a const char *. I am not sure why this is the case, since pos is a const_iterator over a std::string, it is in essence a const char *. I was able to fix the compile error by changing the section to

std::string::const_iterator pos = mat->name.begin() ;
while (pos != mat->name.end())
{
   out.write (&(*pos), 1) ; 
   pos++ ;
}

I don't like this, since if &(*pos) is a const char *, so is pos... Any suggestions here?

The olther problem is everywhere the std::vector::assign() method gets called (lots of places). Everytime, it is called with 1 parameter (always an int). std::vector::assign() should take two parameters (either void assign(size_type _Count, const Type& _Val) or template void assign(InputIterator _First, InputIterator _Last)). The documentation for this method under MSVC++ 6.0 is the same, so I don't see how it can compile correctly under MSVC++ 6.0, either... Looking at the code, it always goes like this...

nodes.assign(numNodes) ;
stream >> nodes ;
stream.readCheck(2) ;

My guess is that it is supposed to be creating a vector with enough memory allocated to hold numNodes Node classes? But then it only reads 1 node from the input stream into the vector? Anybody got a hint for me as to what it is doing here so I can try to fix it?

Thanks,
Jason
Page «Previous 1 2
#1
06/14/2002 (10:47 am)
For the missing ctl3d.h headers go ahead and comment them out.

According to Microsoft they are obsolete now.

This will allow you to build the max2dts exporters fine, however I am unable to test if they actually 'work'.

So the only tool that won't compile now is the ms2dtsExporter tool which has a bunch of errors.

It is using the built in vector class, I wonder if making a custom vector class for it will be necessary.
#2
06/14/2002 (11:03 am)
I am pretty sure a custom vector class would not be necessary. If somebody can verify for me that the purpose of calling std::vector::assign() is to force the vector to allocate enough memory to contain the correct number of objects, it is an easy fix, just call std::vector::resize() instead.
#3
06/14/2002 (11:27 am)
Ok like I said here I havn't the means to test this but here is the fix according to my buddy daerid :)

To call assign correctly just add the object type to the end.

so for example
nodes.assign(numNodes);
would become
nodes.assign(numNodes, Node());

Do that for everything and that should fix the vector.assign problem, or at least I think. I don't have the means to test if its working.
#4
06/14/2002 (11:50 am)
Ah! Thank you very much! Yes, that would both cause the vector to hold the correct number of empty Node objetcs and initialize the newly created node objects.
#5
06/14/2002 (11:51 am)
Anyone have the means to test these changes in VC6 to see if they will compile?

If they do this could easily be submitted to GG as a fix.
#6
10/01/2002 (11:18 am)
I made the changes to get TGE to compile under .NET
been using it at home for nearly 2 months now with no issues, I compile the same source code at work under VS 6.0 and have yet to see an issue.
#7
10/10/2002 (8:13 pm)
Ron, thanks for doing this, I prefer the VC.NET IDE over V6 but haven't been able to get a compile, nor had time to fix on my own.

Where are the changes posted in V1_2 or head or ?
#8
10/16/2002 (1:34 am)
I don't like this, since if &(*pos) is a const char *, so is pos... Any suggestions here?

Yes. The variable 'pos' actually has type 'std::basic_string<_Elem,_Traits,_Ax>::const_iterator'. You can get a pointer to a 'const char' by using the overloaded * operator to get a char, and then taking its address. But C++ doesn't know how to get it without some help.

In other words, '&(*pos)' is only the same thing as 'pos' in C. Once you start overloading operators like *(), anything goes.

By the same token, pos++ returns a const_iterator, not a char*, which is why the compiler bitches.
#9
10/25/2002 (8:23 pm)
Will there be "Official" support for VS.NET "7.0" anytime in the near future? Just curious.
#10
10/28/2002 (12:22 am)
I seem to have fixed all the errors above but I'm also getting a ton of these linker errors. I can't find references to where these __RTS* functions are getting called to link them in. Any help?

DTSMatrix.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function _$E1
DTSMesh.obj : error LNK2001: unresolved external symbol __RTC_CheckEsp
DTSQuaternion.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function _$E1
DTSShape.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function _$E1
DTSMilkshapeMesh.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function _$E1
DTSMilkshapeShape.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function _$E1
DTSPlugin.obj : error LNK2001: unresolved external symbol __RTC_CheckEsp
DTSBrushMesh.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function _$E1
DTSMatrix.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
DTSMesh.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
DTSQuaternion.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
#11
10/28/2002 (12:58 am)
Never mind. Found it 5 minutes after posting as usual.

In case others are wondering, I missed a lib directory in the search paths - doh - numb brain...
#12
01/08/2003 (7:18 am)
I'm curious why these changes (such as removing ctl3d.h) are not applied to the HEAD so that obstacles to every coder might be removed?

tone
#13
01/08/2003 (7:46 am)
I think their are a select few developers who are actualy uses .NET, most are still using VS6. I also think that the header file you mentioned is required for a VS6 compile.

-Ron
#14
01/08/2003 (7:49 am)
That I did not know... perhaps this could be if-deffed?

I run VS6 at home and 7 at work and this is just one of several issues I'm encountering. Shy of that, "fixing" and then "unfixing" these nits would seem necessary steps if I were to try to submit a patch without sullying the source tree for others. It would be great if that risk could be factored out.

tone
#15
01/08/2003 (8:00 am)
True,

I am not sure if GG is willing to support another build env, from my point of view they jumped through hoops to get a mingw env.

This might be a question best asked of the GG staff themself.

-Ron
#16
01/08/2003 (2:49 pm)
This is not a compiler/environment specific issue.

In the case of 'assign' I think the author meant 'resize' or 'reserve', since they occur just before reading data (not really assigning anything).

As for the iterator, STL implementations are free to implement iterators as they see fit, the assumption that they are pointers is incorrect. Operator *() is provided to access data.
#17
01/30/2003 (9:45 pm)
OK guys. I'm still a novice to VC 7 so please bear with me. I'm trying to comiple everything under VC7 and I'm not able to get all of it to compile. I've included the Task List below. I'm not worried about the warnings, but I need to resolve these errors. I fixed the ASM files like one post mentioned and changed everything that was mentioned in this post. Can someone tell me what I"m doing wrong in compiling this? Also where is this engine_DEBUG.lib found? I tried searching on all of this but either I didn't provide the correct words, or the search engine just doesn't work correctly.

Thanks in advance
-Keith

Task List
======================================
Torque Demo error PRJ0019: A tool returned an error code: "Performing Custom Build Step"
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\useoldio.h(29): warning C4995: '_OLD_IOSTREAMS_ARE_DEPRECATED': name was marked as #pragma deprecated
Torque Lib error PRJ0019: A tool returned an error code: "Performing Custom Build Step"
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\useoldio.h(29): warning C4995: '_OLD_IOSTREAMS_ARE_DEPRECATED': name was marked as #pragma deprecated
map2dif fatal error LNK1104: cannot open file 'engine_DEBUG.lib'
max2mapExporter fatal error LNK1104: cannot open file 'engine_DEBUG.lib'
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMesh.h(122): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\DTSPlugin.cpp(282): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMesh.h(122): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\DTSMilkshapeShape.cpp(541): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\DTSMilkshapeShape.cpp(574): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMesh.h(122): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSVector.h(194): warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMesh.h(122): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSShape.cpp(186): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSShape.cpp(342): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSShape.cpp(406): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSShape.cpp(476): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSShape.cpp(479): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSShape.cpp(497): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSShape.cpp(515): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSShape.cpp(545): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSShape.cpp(568): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSShape.cpp(590): warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSShape.cpp(591): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSQuaternion.cpp(30): warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSQuaternion.cpp(61): warning C4244: 'initializing' : conversion from 'double' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSQuaternion.cpp(65): warning C4244: 'argument' : conversion from 'double' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSVector.h(194): warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMesh.h(122): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMesh.cpp(214): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMesh.cpp(216): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMesh.cpp(354): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMesh.cpp(420): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMesh.cpp(432): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMatrix.h(55): warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSVector.h(194): warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMatrix.h(299): warning C4244: 'initializing' : conversion from 'int' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMatrix.h(300): warning C4244: 'initializing' : conversion from 'int' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMatrix.h(301): warning C4244: 'initializing' : conversion from 'int' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMatrix.h(302): warning C4244: 'initializing' : conversion from 'int' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMatrix.h(303): warning C4244: 'initializing' : conversion from 'int' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMatrix.h(304): warning C4244: 'initializing' : conversion from 'int' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSMesh.h(122): warning C4018: '<' : signed/unsigned mismatch
c:\The Fallen\tools\ms2dtsExporter\dtsSDK\DTSVector.h(194): warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
c:\The Fallen\tools\ms2dtsExporter\ms2dtsExporter.def warning LNK4017: DESCRIPTION statement not supported for the target platform; ignored
texture2bm8 error PRJ0019: A tool returned an error code: "Performing Custom Build Step"
max2dtsExporter Max4 fatal error LNK1104: cannot open file 'engine_DEBUG.lib'
max2dtsExporter Max3 fatal error LNK1104: cannot open file 'engine_DEBUG.lib'
buildWad fatal error LNK1104: cannot open file 'engine_DEBUG.lib'
#18
02/04/2003 (5:10 pm)
You need to compile everything, which if I recall correctly is the Torque SDK.dsw
Once that is built/compiled you can then open up Torque Demo.dsp and work within that.

I had issues using Torque SDK.dsw for general use, always wanted to recompile every darn thing :(

-Ron
#19
02/04/2003 (6:20 pm)
I've done a global search and replace.

Search for .assign( and replace with .resize(

worked flawlessly
#20
02/04/2003 (7:56 pm)
Thanks for everyones help. The problem was solved by changing my default directory back to c:\torque. I had renamed it to c:\TheFallen to correspond with our group. This fixed everything and it all compiled without complaint in VC7. Thanks again guys!

-Keith
Page «Previous 1 2