I've realized my old dream: porting all my bot source code to ANSI C. It's now all .c files, at the exception of interface.cpp which contains the HL engine interfacing functions and stuff.
But the problem, is that the linker can't seem to find external variables and functions in both situations! I mean that when something is declared in a .c file it can't be accessed from the .cpp file (even if you declare it extern) and vice versa...
look at the output
Quote:
--------------------Configuration: HL:CounterStrike - Win32 Release--------------------
Compiling resources...
Compiling...
bmpfile.c
dxffile.c
mapdata.c
pathmachine.c
console.c
display.c
lrand.c
math.c
mfile.c
util.c
bot.c
bot_cognition.c
bot_combat.c
bot_start.c
interface.cpp
bot_body.c
bot_chat.c
bot_ears.c
bot_eyes.c
bot_navigation.c
weapons.c
Updating resources...
Linking...
Creating library ..\../racc.lib and object ..\../racc.exp
mapdata.obj : error LNK2001: unresolved external symbol _PointBelongsToWorld
bot_body.obj : error LNK2001: unresolved external symbol _PointBelongsToWorld
mapdata.obj : error LNK2001: unresolved external symbol _PlayerTestHull
util.obj : error LNK2001: unresolved external symbol _PlayerTestHull
bot_body.obj : error LNK2001: unresolved external symbol _PlayerTestHull
mapdata.obj : error LNK2001: unresolved external symbol _PlayerTestLine
bot_body.obj : error LNK2001: unresolved external symbol _PlayerTestLine
bot_eyes.obj : error LNK2001: unresolved external symbol _PlayerTestLine
bot_navigation.obj : error LNK2001: unresolved external symbol _PlayerTestLine
bot_navigation.obj : error LNK2001: unresolved external symbol _TestVisibility
mapdata.obj : error LNK2001: unresolved external symbol _TestVisibility
util.obj : error LNK2001: unresolved external symbol _TestVisibility
bot_combat.obj : error LNK2001: unresolved external symbol _TestVisibility
bot_eyes.obj : error LNK2001: unresolved external symbol _TestVisibility
util.obj : error LNK2001: unresolved external symbol _IsLiquid
bot_body.obj : error LNK2001: unresolved external symbol _IsLiquid
bot_navigation.obj : error LNK2001: unresolved external symbol _IsLiquid
bot.obj : error LNK2001: unresolved external symbol _FindMaterialType
bot_ears.obj : error LNK2001: unresolved external symbol _FindMaterialType
interface.obj : error LNK2001: unresolved external symbol "char * racc_version" (?racc_version@@3PADA)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl DllAttaching(void)" (?DllAttaching@@YAXXZ)
interface.obj : error LNK2001: unresolved external symbol "struct server_s Server" (?Server@@3Userver_s@@A)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl DllDetaching(void)" (?DllDetaching@@YAXXZ)
interface.obj : error LNK2001: unresolved external symbol "struct entity_s * entities" (?entities@@3PAUentity_s@@A)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl PlayClientSoundsForBots(struct player_s *)" (?PlayClientSoundsForBots@@YAXPAUplayer_s@@@Z)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl ShowTheWayAroundToBots(struct player_s *)" (?ShowTheWayAroundToBots@@YAXPAUplayer_s@@@Z)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl BotAct(struct player_s *)" (?BotAct@@YAXPAUplayer_s@@@Z)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl BotThink(struct player_s *)" (?BotThink@@YAXPAUplayer_s@@@Z)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl BotSense(struct player_s *)" (?BotSense@@YAXPAUplayer_s@@@Z)
interface.obj : error LNK2001: unresolved external symbol "float __cdecl RandomFloat(float,float)" (?RandomFloat@@YAMMM@Z)
interface.obj : error LNK2001: unresolved external symbol "int player_count" (?player_count@@3HA)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl BotCreate(struct player_s *)" (?BotCreate@@YAXPAUplayer_s@@@Z)
interface.obj : error LNK2001: unresolved external symbol "struct profile_s * __cdecl FindUnusedBotProfile(void)" (?FindUnusedBotProfile@@YAPAUprofile_s@@XZ)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl BotHALSaveBrain(struct player_s *)" (?BotHALSaveBrain@@YAXPAUplayer_s@@@Z)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl BotNavSaveBrain(struct player_s *)" (?BotNavSaveBrain@@YAXPAUplayer_s@@@Z)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl BotReset(struct player_s *)" (?BotReset@@YAXPAUplayer_s@@@Z)
interface.obj : error LNK2001: unresolved external symbol "unsigned char __cdecl VectorIsNull(struct vec_s)" (?VectorIsNull@@YAEUvec_s@@@Z)
interface.obj : error LNK2001: unresolved external symbol "struct entity_s * __cdecl FindEntityByString(struct entity_s *,char,char const *)" (?FindEntityByString@@YAPAUentity_s@@PAU1@DPBD@Z)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl APlayerHasConnected(struct player_s *)" (?APlayerHasConnected@@YAXPAUplayer_s@@@Z)
interface.obj : error LNK2001: unresolved external symbol "float __cdecl DistanceBetween(struct vec_s,struct vec_s)" (?DistanceBetween@@YAMUvec_s@@0@Z)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl TerminateOnError(char const *,...)" (?TerminateOnError@@YAXPBDZZ)
interface.obj : error LNK2001: unresolved external symbol "struct weapon_s * __cdecl FindPlayerWeaponByModel(struct player_s *,char const *)" (?FindPlayerWeaponByModel@@YAPAUweapon_s@@PAUplayer _s@@PBD@Z)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl BuildPlayerReferential(struct vec_s,struct player_s *)" (?BuildPlayerReferential@@YAXUvec_s@@PAUplayer_s@@@ Z)
interface.obj : error LNK2001: unresolved external symbol "struct player_s * pListenserverPlayer" (?pListenserverPlayer@@3PAUplayer_s@@A)
interface.obj : error LNK2001: unresolved external symbol "float __cdecl WrapAngle(float)" (?WrapAngle@@YAMM@Z)
interface.obj : error LNK2001: unresolved external symbol "struct vec_s __cdecl VectorSubstract(struct vec_s,struct vec_s)" (?VectorSubstract@@YA?AUvec_s@@U1@0@Z)
interface.obj : error LNK2001: unresolved external symbol "struct mission_s Mission" (?Mission@@3Umission_s@@A)
interface.obj : error LNK2001: unresolved external symbol "float __cdecl ProcessTime(void)" (?ProcessTime@@YAMXZ)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl TheServerHasJustStarted(void)" (?TheServerHasJustStarted@@YAXXZ)
interface.obj : error LNK2001: unresolved external symbol "void * __cdecl SAFE_Z_malloc(unsigned int)" (?SAFE_Z_malloc@@YAPAXI@Z)
interface.obj : error LNK2001: unresolved external symbol "struct game_config_s GameConfig" (?GameConfig@@3Ugame_config_s@@A)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl SAFE_free(void *)" (?SAFE_free@@YAXPAX@Z)
interface.obj : error LNK2001: unresolved external symbol "void * __cdecl SAFE_realloc(void *,unsigned int)" (?SAFE_realloc@@YAPAXPAXI@Z)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl APlayerHasDisconnected(struct player_s *)" (?APlayerHasDisconnected@@YAXPAUplayer_s@@@Z)
interface.obj : error LNK2001: unresolved external symbol "struct player_s * players" (?players@@3PAUplayer_s@@A)
interface.obj : error LNK2001: unresolved external symbol "struct debug_level_s DebugLevel" (?DebugLevel@@3Udebug_level_s@@A)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl DispatchSound(char const *,struct vec_s,float,float)" (?DispatchSound@@YAXPBDUvec_s@@MM@Z)
interface.obj : error LNK2001: unresolved external symbol "char const * __cdecl GetField(char const *,int)" (?GetField@@YAPBDPBDH@Z)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl PlayBulletSoundsForBots(struct player_s *)" (?PlayBulletSoundsForBots@@YAXPAUplayer_s@@@Z)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl BotFeedEar(struct player_s *,struct sound_s *,struct vec_s,float)" (?BotFeedEar@@YAXPAUplayer_s@@PAUsound_s@@Uvec_s@@M @Z)
interface.obj : error LNK2001: unresolved external symbol "struct sound_s * __cdecl FindSoundByFilename(char const *)" (?FindSoundByFilename@@YAPAUsound_s@@PBD@Z)
interface.obj : error LNK2001: unresolved external symbol "char * __cdecl UpperCase(char const *)" (?UpperCase@@YAPADPBD@Z)
interface.obj : error LNK2001: unresolved external symbol "int __cdecl ServerConsole_printf(char const *,...)" (?ServerConsole_printf@@YAHPBDZZ)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl BotIssueClientCommand(struct player_s *,char const *,...)" (?BotIssueClientCommand@@YAXPAUplayer_s@@PBDZZ)
interface.obj : error LNK2001: unresolved external symbol "void __cdecl BotSetIdealYaw(struct player_s *,float)" (?BotSetIdealYaw@@YAXPAUplayer_s@@M@Z)
interface.obj : error LNK2001: unresolved external symbol "char * racc_welcometext" (?racc_welcometext@@3PADA)
interface.obj : error LNK2001: unresolved external symbol "long __cdecl RandomLong(long,long)" (?RandomLong@@YAJJJ@Z)
interface.obj : error LNK2001: unresolved external symbol "int __cdecl ServerCommand(int,char * *)" (?ServerCommand@@YAHHPAPAD@Z)
interface.obj : error LNK2001: unresolved external symbol "char const * __cdecl TeamNameOf(struct player_s *)" (?TeamNameOf@@YAPBDPAUplayer_s@@@Z)
bot_chat.obj : error LNK2001: unresolved external symbol _PlayerStopTalking
bot_chat.obj : error LNK2001: unresolved external symbol _PlayerStartTalking
bot_eyes.obj : error LNK2001: unresolved external symbol _GetBonePosition
bot_navigation.obj : error LNK2001: unresolved external symbol _IsThinAir
..\../racc.dll : fatal error LNK1120: 60 unresolved externals
Error executing link.exe.
racc.dll - 74 error(s), 0 warning(s)
|
Does anybody have an explanation ? Don't tell me it's impossible, argh... no...