Author Topic: [C/C++] Linker errors - Express 2008  (Read 5276 times)

0 Members and 1 Guest are viewing this topic.

Offline Voltage

  • Professor
  • Pentium
  • *****
  • Posts: 857
  • Karma: 53
    • View Profile
[C/C++] Linker errors - Express 2008
« on: March 11, 2010 »
Hey all,

I'm getting these linker errors in Release mode only:
Code: [Select]
1>msys_soundOS.obj : error LNK2019: unresolved external symbol @FMUSIC_LoadSong@8 referenced in function "void __fastcall msys_musicInit(void)" (?msys_musicInit@@YIXXZ)
1>msys_soundOS.obj : error LNK2019: unresolved external symbol @FSOUND_File_SetCallbacks@20 referenced in function "void __fastcall msys_musicInit(void)" (?msys_musicInit@@YIXXZ)
1>msys_soundOS.obj : error LNK2019: unresolved external symbol @FMUSIC_PlaySong@4 referenced in function "void __fastcall msys_musicStart(void)" (?msys_musicStart@@YIXXZ)
1>msys_soundOS.obj : error LNK2019: unresolved external symbol @FMUSIC_FreeSong@4 referenced in function "void __fastcall msys_musicEnd(void)" (?msys_musicEnd@@YIXXZ)

The linker 'Additional dependancies' are the same for both debug and release configs.
opengl32.lib minifmod.lib winmm.lib glu32.lib

I've been at this for a couple of hours now. 

Any ideas?
Challenge Trophies Won:

Offline efecto

  • C= 64
  • **
  • Posts: 90
  • Karma: 4
    • View Profile
Re: [C/C++] Linker errors - Express 2008
« Reply #1 on: March 11, 2010 »
Are you sure the additionals directories are the same for debug and release?


Offline Voltage

  • Professor
  • Pentium
  • *****
  • Posts: 857
  • Karma: 53
    • View Profile
Re: [C/C++] Linker errors - Express 2008
« Reply #2 on: March 11, 2010 »
oh yeah.  Checked and rechecked.

It works fine in Debug mode, but I get the above listed linker errors in Release mode only.

I could post screen shots...  but really, the dependancies are the same in both configs.
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C/C++] Linker errors - Express 2008
« Reply #3 on: March 11, 2010 »
Maybe try turning off the linker optimisations?  The 'Remove Unused Code' one.  Also, check the calling convention - if the .h file is badly written it might not have the #ifdef __cplusplus extern "C" stuff in it.  I thin there's an option that sets it to cdecl - maybe that's set in debug and not in release?  Also, check the preprocessor directives - they could be bringing in different code in each build type.

Jim
Challenge Trophies Won:

Offline Voltage

  • Professor
  • Pentium
  • *****
  • Posts: 857
  • Karma: 53
    • View Profile
Re: [C/C++] Linker errors - Express 2008
« Reply #4 on: March 12, 2010 »
Thanks for the info Jim, unfortunately the problem remains.

1) Linker optimisations - I tried all settings on all options here.  I tried matching the same as the debug config.

2) .h #ifdef __cplusplus extern "C" - is present in the file.  There are 2 preprocessor #IF scopes in the file, and I tried commenting either and both out, with no change.

3) The preprocessor DEFINES are different for both builds, but I tried setting the release ones to match the debug ones, and the link errors remain.

Some other things that I've tried:

4) Tried it on VS professional 2008 at work, same issue.

5) Rebuilt the minifmod library in 2008, same issue.

6) removed the library from the libs directory, and got the expected can't find lib linker errors.

7)  :crutches:

If I was to post the project, which large files can I saftley remove from the archive, without killing the project?  (I know you'd mentioned this to Clyde b4 but I couldn't find it).
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C/C++] Linker errors - Express 2008
« Reply #5 on: March 12, 2010 »
Rats! :(  Are you in a position to post the code and project file?

Jim
Challenge Trophies Won:

Offline Voltage

  • Professor
  • Pentium
  • *****
  • Posts: 857
  • Karma: 53
    • View Profile
Re: [C/C++] Linker errors - Express 2008
« Reply #6 on: March 12, 2010 »
Gladly.  Thanks Jim.

I'm building on a 64k framework done by iq/rgba.

I've added opengl text, and now I'm trying to add minifmod.  As you already know, it works in debug mode, but not in release mode.

You'll need minifmod.lib.  I can post that too if you need it.
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: [C/C++] Linker errors - Express 2008
« Reply #7 on: March 12, 2010 »
I'm still running VC 2005 so I couldn't open your project but I guess that setting the calling-convention to "__cdecl" instead of "__fastcall" should solve your problem.
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: [C/C++] Linker errors - Express 2008
« Reply #8 on: March 12, 2010 »
Hellfire is right, change it to __cdecl.

The next step you need to do is set:
Linker / Ignore all default libraries = YES
And in Additional dependencies add msvcrts.lib that I've attached here for you.


Challenge Trophies Won:

Offline Voltage

  • Professor
  • Pentium
  • *****
  • Posts: 857
  • Karma: 53
    • View Profile
Re: [C/C++] Linker errors - Express 2008
« Reply #9 on: March 12, 2010 »
Thank you guys!  That's working like a charm.

 :|| :clap: :buddies: :cheers: :carrot: :inspired: :updance:

"Change from __fastcall to __cdecl".  Even after my seemingly endless poking around in the project properties, I did not see this option.
Challenge Trophies Won: