Author Topic: Help compiling this 4K.  (Read 7818 times)

0 Members and 1 Guest are viewing this topic.

Offline Aeko

  • C= 64
  • **
  • Posts: 27
  • Karma: 1
    • View Profile
Help compiling this 4K.
« on: July 09, 2008 »
Hi !

I'm trying to compile with VC2005 some project from VC2003.

I've change and tried many project options and flags, but every time I get this linking errors:

1>Linking...
1>main.obj : error LNK2019: unresolved external symbol __CIcos referenced in function _cosf
1>synth.obj : error LNK2001: unresolved external symbol __CIcos
1>main.obj : error LNK2019: unresolved external symbol __CIsin referenced in function _sinf
1>synth.obj : error LNK2001: unresolved external symbol __CIsin
1>main.obj : error LNK2019: unresolved external symbol __CIsqrt referenced in function _sqrtf
1>main.obj : error LNK2019: unresolved external symbol __ftol2_sse referenced in function "void __cdecl rotated_cube(int,int,int)" (?rotated_cube@@YAXHHH@Z)
1>main.obj : error LNK2019: unresolved external symbol _memset referenced in function "void __cdecl play(void *,long)" (?play@@YAXPAXJ@Z)
1>Release/voxel_bukkake_w32.exe : fatal error LNK1120: 5 unresolved externals


Can anyone help me compiling it on VC2005 ?

Thanks for any answer.
 

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: Help compiling this 4K.
« Reply #1 on: July 10, 2008 »
Quote
error LNK2019: unresolved external symbol __ftol2_sse
Add compiler-switch /QIfist

Quote
error LNK2019: unresolved external symbol __CIcos referenced in function _cosf
error LNK2019: unresolved external symbol __CIsin referenced in function _sinf
error LNK2019: unresolved external symbol __CIsqrt referenced in function _sqrtf
Try this:
Code: [Select]
extern "C"
{

float __declspec(naked) _CIcos()
{
   _asm {
      fcos
      ret
   };
};

float __declspec(naked) _CIsin()
{
   _asm {
      fsin
      ret
   };
};

float __declspec(naked) _CIsqrt()
{
   _asm {
      fsqrt
      ret
   };
};

};


Challenge Trophies Won:

Offline Aeko

  • C= 64
  • **
  • Posts: 27
  • Karma: 1
    • View Profile
Re: Help compiling this 4K.
« Reply #2 on: July 10, 2008 »
Thanks a lot Hellfire,

I'm also getting two errors that I can't solve.

Anyway, I'll try to isolate the synth, so is the part I'm interesting on.

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: Help compiling this 4K.
« Reply #3 on: July 11, 2008 »
Quote
I'm also getting two errors that I can't solve
Namely?
Challenge Trophies Won:

Offline Aeko

  • C= 64
  • **
  • Posts: 27
  • Karma: 1
    • View Profile
Re: Help compiling this 4K.
« Reply #4 on: July 11, 2008 »
Hi Hellfire,

1>------ Build started: Project: voxel_bukkake_w32, Configuration: Release Win32 ------
1>Compiling...
1>cl : Command line warning D9035 : option 'QIfist' has been deprecated and will be removed in a future release
1>synth.cpp
1>main.cpp
1>.\main.cpp(93) : warning C4005: 'ARRAYSIZE' : macro redefinition
1>        C:\Archivos de programa\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(950) : see previous definition of 'ARRAYSIZE'
1>Generating Code...
1>Linking...
1>main.obj : error LNK2019: unresolved external symbol _memset referenced in function "void __cdecl play(void *,long)" (?play@@YAXPAXJ@Z)
1>Release/voxel_bukkake_w32.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Gabriel\Mis documentos\Visual Studio 2005\Projects\voxel_bukkake_release\voxel_bukkake_release\win32_src\Release\BuildLog.htm"
1>voxel_bukkake_w32 - 2 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Looking more carefully the project I've sawn that final linking is doing using crinkler (see c.bat). Is also interesting to see the way they do thru crinkler, althought some other linking errors appears.

I've also succesfully build all modifing some lines of the program (comment them) and linking with the default libraries.

Anyway,

Tomorrow, I'm going for a week on holidays. My wife has explicitly told me "please, don't come with computers".  ;D

So, see you all in a week  :cheers:

Offline Naptha

  • C= 64
  • **
  • Posts: 53
  • Karma: 3
    • View Profile
Re: Help compiling this 4K.
« Reply #5 on: July 12, 2008 »
Are you compiling with /NODEFAULTLIB?  The simplest way to fix your problem in that case would be to allow linking with the MSVC runtime libraries - in project options go to linker, somewhere there is a "Ignore default libraries" option, change it to NO.

Alternatively if you want to remain free from the runtime libraries, you need to implement the missing functions yourself (that's the unresolved symbols the linker complains about).  In this case you have memset somewhere in your code, I just ran into this too, here is the code I used:

Code: [Select]
__forceinline void _MEMSET_( void *_dst, int _val, size_t _sz )
{
   while ( _sz ) ((BYTE *)_dst)[--_sz] = _val;
}

Add that in, and replace calls to memset with calls to this _MEMSET_.

I think it starts complaining about this when you move a VS2003 project to VS2005, because VS2003 I believe used the old msvcrt.lib whereas VS2005+ use the newer runtimes?  But I just started this, so that's just my guess.  I suppose if that's true, you can find a copy of msvcrt.lib and link it..?

EDIT: Nevermind, just read that you managed to compile with the default libraries.  :D  Oh well, maybe this will give you some help if you decide you'd rather not use them after all!
« Last Edit: July 12, 2008 by Naptha »