Author Topic: I got alot of problems with Raknet and visual c++ 6  (Read 44544 times)

NightMarez

  • Not-a-newbie
  • *
  • Posts: 14
  • Karma: 0
    • View Profile
I got alot of problems with Raknet and visual c++ 6
« on: February 15, 2006, 08:14:31 AM »
Hi.

Im not sure why, but the only excample i can compile is the zlibstatic project.

i get TONS of errors every other project, except autopatcher one, where i only get these

--------------------Configuration: Autopatcher - Win32 Release--------------------
C:\RakNet\Samples\Code Samples\Autopatcher\AutopatcherTest.cpp(13): Could not find the file unistd.h.
C:\RakNet\zLib\zconf.h(289): Could not find the file unistd.h.
C:\RakNet\zLib\zconf.h(291): Could not find the file unixio.h.
Linking...
RakNetLibStatic.lib(BitStream.obj) : error LNK2001: unresolved external symbol __ftol2
Release/Autopatcher.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Autopatcher.exe - 2 error(s), 0 warning(s)

im not sure, but how do i make this work under visual c++ 6.0 ?

Do i need some windows dev packs ? other things installed?

I tryed to locate this info on the forum, but there is very limitet info about visual c++ 6 and raknet.

in some of the projects i get up to 17 errors, and tryed one that gave 480+ warnings and some errors.

Thanks
« Last Edit: February 15, 2006, 08:31:04 AM by NightMarez »

tewfic

  • Not-a-newbie
  • *
  • Posts: 13
  • Karma: 0
    • View Profile
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #1 on: February 15, 2006, 08:29:07 AM »

you can compile zlib surely because zlib is made in c and not c++


NightMarez

  • Not-a-newbie
  • *
  • Posts: 14
  • Karma: 0
    • View Profile
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #2 on: February 15, 2006, 08:32:17 AM »
okay thanks, but what about making it work under vc++ 6 ?  ::)

it seems like a awesome networking lib, and my old one is kinda not so good for what i need it to do,
while this seems to be more then capable for it.


tewfic

  • Not-a-newbie
  • *
  • Posts: 13
  • Karma: 0
    • View Profile
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #3 on: February 15, 2006, 08:38:27 AM »

Did you tried to link your project with DLL libs ?

If you want to recompile RakNet, you will have to have it ported to VC6







Silver Hawk

  • Full Member
  • ***
  • Posts: 105
  • Karma: 0
    • View Profile
    • Crestock
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #4 on: February 15, 2006, 08:50:00 AM »
If you want to recompile RakNet, you will have to have it ported to VC6

Sorry but there is not a RakNet.dsw that you can use. Why do you have to port it ????

Michael

Silver Hawk

  • Full Member
  • ***
  • Posts: 105
  • Karma: 0
    • View Profile
    • Crestock
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #5 on: February 15, 2006, 08:52:12 AM »
Linking...
RakNetLibStatic.lib(BitStream.obj) : error LNK2001: unresolved external symbol __ftol2
Release/Autopatcher.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Concerning __ftol2 you can have a look at here.

Michael

tewfic

  • Not-a-newbie
  • *
  • Posts: 13
  • Karma: 0
    • View Profile
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #6 on: February 15, 2006, 09:27:28 AM »

well,

it is common that you have to change minor things from a version of vc to another

and also, microsoft compilers are not allways compliant with c++ standard

I presume 7.1 is more compliant than 6



Silver Hawk

  • Full Member
  • ***
  • Posts: 105
  • Karma: 0
    • View Profile
    • Crestock
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #7 on: February 15, 2006, 09:40:54 AM »
--------------------Configuration: Autopatcher - Win32 Release--------------------
C:\RakNet\Samples\Code Samples\Autopatcher\AutopatcherTest.cpp(13): Could not find the file unistd.h.
C:\RakNet\zLib\zconf.h(289): Could not find the file unistd.h.
C:\RakNet\zLib\zconf.h(291): Could not find the file unixio.h.

This is because in the AutopatcherTest.cpp you have:

Code: [Select]
#ifdef _WIN32
#include <windows.h> // Sleep
#else
#include <unistd.h> // usleep
#endif

but _WIN32 is not defined in the project pre-processor definition. There it is defined WIN32. Change it to _WIN32 and the cannot find errors will disappear :).

I am not sure if this is a bug in the project...

Best wishes,
Michael

Silver Hawk

  • Full Member
  • ***
  • Posts: 105
  • Karma: 0
    • View Profile
    • Crestock
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #8 on: February 15, 2006, 09:48:30 AM »
Also you will have to change in all projects WIN32 with _WIN32.

Anyway, I still get several errors while try to compile RakNet (the latest version) with VC6...

Michael

NightMarez

  • Not-a-newbie
  • *
  • Posts: 14
  • Karma: 0
    • View Profile
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #9 on: February 15, 2006, 09:57:51 AM »
Yeah you are right, it did remove a few of the errors (file stuff).

however, still getting the error:

Deleting intermediate files and output files for project 'Autopatcher - Win32 Release'.
--------------------Configuration: Autopatcher - Win32 Release--------------------
Compiling...
Command line warning D4024 : unrecognized source file type 'PRECOMP_VC7_TOBEREMOVED', object file assumed
Command line warning D4027 : source file 'PRECOMP_VC7_TOBEREMOVED' ignored
Autopatcher.cpp
./../../../Include\NetworkTypes.h(161) : warning C4068: unknown pragma
./../../../Include\NetworkTypes.h(193) : warning C4068: unknown pragma
AutopatcherTest.cpp
./../../../Include\NetworkTypes.h(161) : warning C4068: unknown pragma
./../../../Include\NetworkTypes.h(193) : warning C4068: unknown pragma
DownloadableFileDescriptor.cpp
./../../../Include\NetworkTypes.h(161) : warning C4068: unknown pragma
./../../../Include\NetworkTypes.h(193) : warning C4068: unknown pragma
Generating Code...
Linking...
RakNetLibStatic.lib(BitStream.obj) : error LNK2001: unresolved external symbol __ftol2
Release/Autopatcher.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Autopatcher.exe - 2 error(s), 8 warning(s)

i tryed adding

#if (_MSC_VER >= 1300) && (WINVER < 0x0500)
//VC7 or later, building with pre-VC7 runtime libraries
extern "C" long _ftol( double ); //defined by VC6 C libs
extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#endif

but that didnt change anything, not sure if i added it the right file.

Silver Hawk

  • Full Member
  • ***
  • Posts: 105
  • Karma: 0
    • View Profile
    • Crestock
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #10 on: February 15, 2006, 10:06:37 AM »
Yeah you are right, it did remove a few of the errors (file stuff).

however, still getting the error:

Deleting intermediate files and output files for project 'Autopatcher - Win32 Release'.
--------------------Configuration: Autopatcher - Win32 Release--------------------
Compiling...
Command line warning D4024 : unrecognized source file type 'PRECOMP_VC7_TOBEREMOVED', object file assumed
Command line warning D4027 : source file 'PRECOMP_VC7_TOBEREMOVED' ignored

'PRECOMP_VC7_TOBEREMOVED' should also be removed. I have done one time, but I do not remember exactly how.

Linking...
RakNetLibStatic.lib(BitStream.obj) : error LNK2001: unresolved external symbol __ftol2
Release/Autopatcher.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Autopatcher.exe - 2 error(s), 8 warning(s)

i tryed adding

#if (_MSC_VER >= 1300) && (WINVER < 0x0500)
//VC7 or later, building with pre-VC7 runtime libraries
extern "C" long _ftol( double ); //defined by VC6 C libs
extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#endif

but that didnt change anything, not sure if i added it the right file.

I have given a fast try too and I have had some problems too (strange, because it worked time ago ???). Try to add WINVER=0x0400 to the pre-processor instructions.

Try also this:

Quote
#ifdef __cplusplus
  #define EXTERN_C extern "C"
#else
  #define EXTERN_C
#endif // __cplusplus

#if (_MSC_VER >= 1300) && (WINVER < 0x0500)
//VC7 or later, building with pre-VC7 runtime libraries
EXTERN_C long _ftol( double ); //defined by VC6 C libs
EXTERN_C long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#endif

May another Windows library should be added. It is worth a try anyway.

Michael

NightMarez

  • Not-a-newbie
  • *
  • Posts: 14
  • Karma: 0
    • View Profile
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #11 on: February 15, 2006, 10:19:09 AM »
oki, added

#ifdef __cplusplus
  #define EXTERN_C extern "C"
#else
  #define EXTERN_C
#endif // __cplusplus

#if (_MSC_VER >= 0) && (WINVER < 0x0500)
//VC7 or later, building with pre-VC7 runtime libraries
EXTERN_C long _ftol( double ); //defined by VC6 C libs
EXTERN_C long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#endif

and the preprocessor defination, however now i get this error:

--------------------Configuration: Autopatcher - Win32 Release--------------------
Compiling...
Command line warning D4024 : unrecognized source file type 'PRECOMP_VC7_TOBEREMOVED', object file assumed
Command line warning D4027 : source file 'PRECOMP_VC7_TOBEREMOVED' ignored
AutopatcherTest.cpp
./../../../Include\NetworkTypes.h(161) : warning C4068: unknown pragma
./../../../Include\NetworkTypes.h(193) : warning C4068: unknown pragma
Linking...
RakNetLibStatic.lib(CheckSum.obj) : fatal error LNK1103: debugging information corrupt; recompile module
Error executing link.exe.
Creating browse info file...

Autopatcher.exe - 1 error(s), 4 warning(s)

so i guess ill try to recompile the module and see if that works.

NightMarez

  • Not-a-newbie
  • *
  • Posts: 14
  • Karma: 0
    • View Profile
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #12 on: February 15, 2006, 12:21:10 PM »
i find too many errors when i try this, so im not gonna use days to fix this to "maybe" work with vc++ 6.

too bad, it seemed like a awesome networking sollution, im just sad that it dont come for multiple platforms.

maybe some day when it comes like eg. ogre with multi platform support, ill consider it again :( .

thanks for the help though :)

tewfic

  • Not-a-newbie
  • *
  • Posts: 13
  • Karma: 0
    • View Profile
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #13 on: February 15, 2006, 12:31:36 PM »


As I see, you are still linking with StaticLib, you did not even tried with dynamic libraries

go in Configuration Properties, then link and replace RakNetLibStatic.lib by RakNetDLL.lib

you also need to place RakNet.dll in the same directory than Autopatch ( or the current project you are testing )



Silver Hawk

  • Full Member
  • ***
  • Posts: 105
  • Karma: 0
    • View Profile
    • Crestock
Re: I got alot of problems with Raknet and visual c++ 6
« Reply #14 on: February 15, 2006, 12:39:54 PM »
i find too many errors when i try this, so im not gonna use days to fix this to "maybe" work with vc++ 6.

too bad, it seemed like a awesome networking sollution, im just sad that it dont come for multiple platforms.

maybe some day when it comes like eg. ogre with multi platform support, ill consider it again :( .

thanks for the help though :)

You can try with DLLs as suggested by tewfic.

As alternative you can compile RakNet by using MS Toolkit 2003 (free compiler/linker). You can use Code::Blocks IDE which supports it. Code::Blocks has also an import functionality for DEV-C++ projects, VC6 workspaces/projects (not yet completed) and VC 7.1 solutions/projects. I have given a try by importing RakNet solution and it worked with some modifications (this was anyway, with a previous RakNet version).

Michael