How to compile TORCS with visual studio 2005(VC 8.0)

TORCS is an open source, highly portable multi platform car racing simulation. It is used as ordinary car racing game, as AI racing game and as research platform.
image

TORCS can be compiled smoothly with Visual C++ 6.0.but you’ll get lots of compilation errors when trying to compile it with Visual Studio 2005(VC 8).here is the steps to resolve this issue:

  • change linker option for all projects from /NODEFAULTLIB:"LIBCD" to /NODEFAULTLIB:"LIBC".
  • add a new cpp file(for example, vs2008.cpp) to the client project with the following contents :
    extern "C"
    {
    	int __mb_cur_max;
    	int errno;
    }
    
  • add /force:multiple linker option to the client project.
  • define M_PI in ac3dload.cpp,trackdata.cpp and osspec.h:
    #ifndef M_PI
    #define M_PI 3.14159267
    #endif
    
  • fix errors in type-casting ,such as from sqrt(…) to sqrt((double)…)

you can download the compiled version of my robot and racing with me in TORCS:):

2 thoughts on “How to compile TORCS with visual studio 2005(VC 8.0)”

Leave a Reply

Your email address will not be published.