Topic: Error when linking  (Read 4846 times)

0 Members and 1 Guest are viewing this topic.

Pi-R

  • Guest
Error when linking
« on: January 21, 2003, 02:13:25 am »
Hi,

I'm just starting to learn how to write scripts. I have some programming knowledge, but no experience with C++.

I have Visual C++ 6.0 with service pack 5 installed and the SFC2EAW API using NuclearWessels SFC2 Mission Scripting Guide. I started creating his example 1 but when I try to build the script (12.1.1 step 4) I get an LNK2001 error.  See the first part of the build log:

--------------------Configuration: His_TestSkirmish - Win32 Release--------------------
Compiling...
CommonDefs.cpp
MissionMaps.cpp
MissionText.cpp
BaseVictoryState.cpp
BaseVictory.cpp
PlayerTeamBaseState.cpp
PlayerShipBaseState.cpp
PlayerShip.cpp
PlayerTeam.cpp
PlayerNPCTeamBaseState.cpp
PlayerNPCTeam.cpp
EnemyTeamBaseState.cpp
EnemyTeam.cpp
NPC1TeamBaseState.cpp
NPC1Team.cpp
His_TestSkirmish.cpp
Linking...
   Creating library Release/His_TestSkirmish.lib and object Release/His_TestSkirmish.exp
scriptinterfaceR.lib(ScriptStructs.obj) : error LNK2001: unresolved external symbol "public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ)
...
etc


Can anyone please tell me what might be causing this? Did I forgot something? Has it something to do with the PlayerNPC... and NPC1... files as there are only two teams: player and enemy?
 

FPF_TraceyG

  • Guest
Re: Error when linking
« Reply #1 on: January 21, 2003, 04:45:27 am »
You need to make a few changes to your linker options in your VC++ workspace. By selecting Project -> Settings from the menu bar, then click on the Link tab and make sure you have the following libraries (this is taken directly from my own settings):

Object/Library modules:

sharedr.lib scriptinterfaceR.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dmp3d_MSVCR.lib sfcTiger_MSVCR.lib dmp3D_MSVCR.lib bugslayerutil.lib cryptlibR.lib ShipList.lib

Project Options:

sharedr.lib scriptinterfaceR.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dmp3d_MSVCR.lib sfcTiger_MSVCR.lib dmp3D_MSVCR.lib bugslayerutil.lib cryptlibR.lib ShipList.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"Release/Met_TG1Patrol.pdb" /machine:I386 /out:"../../../source/assets/scripts/Met_TG1Patrol.scr" /implib:"Release/Met_TG1Patrol.lib" /libpath:"..\..\libraries" /libpath:"..\..\ShipList\api"

My mission script here is called Met_TG1Patrol, so yours should look something similar with whatever name you called your mission script. Hope this helps.  

Pi-R

  • Guest
Re: Error when linking
« Reply #2 on: January 21, 2003, 02:07:38 pm »
Thanks Tracy,

I made the changes you suggested.

When I build the script now I get no errors, only two warnings:

--------------------Configuration: His_TestSkirmish - Win32 Debug--------------------
Linking...
LINK : warning LNK4075: ignoring /EDITANDCONTINUE due to /INCREMENTAL:NO specification
   Creating library Release/His_TestSkirmish.lib and object Release/His_TestSkirmish.exp
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library

His_TestSkirmish.scr - 0 error(s), 2 warning(s)


Are these serious?  

FPF_TraceyG

  • Guest
Re: Error when linking
« Reply #3 on: January 22, 2003, 03:09:39 pm »
Hmmm... you have an extra library by the looks of it..
But if the mission script works I wouldnt worry about it.

Perhaps if you could show me what includes you are using?  

Karnak

  • Guest
Re: Error when linking
« Reply #4 on: January 22, 2003, 06:16:43 pm »
Quote:

Thanks Tracy,

I made the changes you suggested.

When I build the script now I get no errors, only two warnings:

--------------------Configuration: His_TestSkirmish - Win32 Debug--------------------
Linking...
LINK : warning LNK4075: ignoring /EDITANDCONTINUE due to /INCREMENTAL:NO specification
   Creating library Release/His_TestSkirmish.lib and object Release/His_TestSkirmish.exp
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library

His_TestSkirmish.scr - 0 error(s), 2 warning(s)


Are these serious?  




Your multi-threaded library for basic library functionality  is clashing with a library.  Best way to debug this is by lopping off libraries one by one in your "input library" setting and keep building you .scr binary after each change.  Atlhough, some people choose to ignore warnings, good programmers never take anything for granted and eliminate warning messages at all times. Along, with doing the daily build, etc.  
« Last Edit: December 31, 1969, 06:00:00 pm by Karnak »

FPF_TraceyG

  • Guest
Re: Error when linking
« Reply #5 on: January 22, 2003, 09:00:03 pm »
I dont get any linker error messages when I'm compiling with the above settings at all.

You might also try checking  your Project Options under the C/C++ tab in your Project->Settings as well.

Mine are as follows:
/nologo /MT /W3 /GR /GX /O2 /I "..\..\ScriptInterface" /I "..\..\Shared" /I "..\..\Shared\QSI\Projects\QSIInc\Tiger" /I "..\..\Shared\Source\Taldren\Common" /I "..\..\Shared\Source\Taldren\Common\Exceptions" /I "..\..\Shared\Source\Taldren\Common\DataStore" /I "..\..\Shared\Source\Taldren\Common\Log" /I "..\..\Shared\Source\Taldren\Common\Log\MessageDLL" /I "..\..\Shared\Source\Taldren\Common\Thread" /I "..\..\Shared\Source\Taldren\Common\BugSlayer" /I "..\..\Shared\Source\Taldren\Common\Crypto" /I "..\..\Shared\Source\Taldren\Common\Database" /I "..\..\Shared\Source\Include" /I "..\..\Shared\Source\Scripting" /I "..\..\Shared\Source\Network" /I "..\..\Shared\Source\PrecompiledHeaders..\..\ScriptInterface" /I "..\..\Shared\Source\PrecompiledHeaders" /I "..\..\ShipList\api" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR"Release/" /Fp"Release/Met_TG1Patrol.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c  

Pi-R

  • Guest
Re: Error when linking
« Reply #6 on: January 23, 2003, 03:21:45 pm »
Hi again,

I tried Tracy´s suggestion first. Just because this seemed to take less time than Karnak suggestion
 .
Mine project options read differently::
/nologo /MTd /W3 /Gm /GR /GX /ZI /Od /I "../../scriptinterface" /I "../../../QSIInc/Tiger" /I "../../../Source/Include" /I "..\..\ScriptInterface" /I "..\..\Shared" /I "..\..\Shared\QSI\Projects\QSIInc\Tiger" /I "..\..\Shared\Source\Taldren\Common" /I "..\..\Shared\Source\Taldren\Common\Exceptions" /I "..\..\Shared\Source\Taldren\Common\DataStore" /I "..\..\Shared\Source\Taldren\Common\Log" /I "..\..\Shared\Source\Taldren\Common\Log\MessageDLL" /I "..\..\Shared\Source\Taldren\Common\Thread" /I "..\..\Shared\Source\Taldren\Common\BugSlayer" /I "..\..\Shared\Source\Taldren\Common\Crypto" /I "..\..\Shared\Source\Taldren\Common\Database" /I "..\..\Shared\Source\Include" /I "..\..\Shared\Source\Scripting" /I "..\..\Shared\Source\Network" /I "..\..\Shared\Source\PrecompiledHeaders" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "kRandomChatter" /FR"Debug/" /Fp"Debug/His_TestSkirmish.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c

So I replaced them with Tracy´s  settings and it worked: no errors and no warnings following th build and the created script works fine (for as far as I can tell at the moment).

Thanks for your help both,  

FPF_TraceyG

  • Guest
Re: Error when linking
« Reply #7 on: January 23, 2003, 07:52:49 pm »
Glad it's all working then... let me know how you go with mission scripting...    

Karnak

  • Guest
Re: Error when linking
« Reply #8 on: March 04, 2003, 07:51:08 pm »
When you are creating a brand new mission script using the CreateScript.dll Add-in it's sets up your project file to ignore you basic C/C++ libaries like libcmt.lib, libc.lib.  If you don't take these settings out using the "link->input" tab of you Project setting file you will get multiple unresolved externals for basic C/C++ functions.

Another exercise that may be useful is to properly setup the IDE's directories for include and library files using "Tools->Options->Directories"

For include directories add from base dir "..\API\SFC2 - API RELEASE 1.2":
SCRIPTS\STL\INCLUDE
SHARED\QSI\PROJECTS\QSIINC\TIGER
SHARED\SOURCE\INCLUDE
SCRIPTINTERFACE
SHARED\SOURCE\TALDREN\COMMON
SHARED\SOURCE\TALDREN\COMMON\EXCEPTIONS
SHARED\SOURCE\TALDREN\COMMON\DATABASE

For library directories add from base dir "..\API\SFC2 - API RELEASE 1.2":
SCRIPTS\STL\LIB
LIBRARIES

These settings will negate the need to copy Taldren header and library files into the core include/lib directories of you VC++ 6.0 IDE.  IMHO, it's never a good idea to mix and match base Microsoft files with 3rd party vendor files in the same dir.  One could delete a core MS file by accident if they are all in the same dir.



 
« Last Edit: December 31, 1969, 06:00:00 pm by Karnak »