Author Topic: Getting FSO to compile with MSVS2005  (Read 6338 times)

0 Members and 1 Guest are viewing this topic.

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Getting FSO to compile with MSVS2005
I picked up Microsoft Visual Studio 2005 Standard Edition (Academic version) recently, and I've almost got it compiling FSO.

First, I tried the MSVC2005 project. That failed miserably. It couldn't find any of the headers. Then I converted the MSVC6 project, and that sort of worked. After fixing a pair of little bugs (see my commit from today), it started complaining about quartz.lib. I took it out of the included library list, to see if I could just ignore it. It then gave me this. Any help?

Note that I never had any problems with compiling on Linux with GCC.
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: Getting FSO to compile with MSVS2005
Thanks to some help from Goob, I've gotten a bit further. I've added code.lib to the libraries for FRED and FreeSpace2, and taken out linci.lib. I now get this error on all three projects:
Code: [Select]
BSCMAKE: error BK1513 : nonincremental update requires all .SBR files

Also, both the FreeSpace2 and FRED projects gives me this:
Code: [Select]
code.lib(collideshipship.obj) : error LNK2001: unresolved external symbol "class ade_obj<struct object_h> l_Ship" (?l_Ship@@3V?$ade_obj@Uobject_h@@@@A)
code.lib(collidedebrisship.obj) : error LNK2001: unresolved external symbol "class ade_obj<struct object_h> l_Ship" (?l_Ship@@3V?$ade_obj@Uobject_h@@@@A)
code.lib(collideshipweapon.obj) : error LNK2001: unresolved external symbol "class ade_obj<struct object_h> l_Ship" (?l_Ship@@3V?$ade_obj@Uobject_h@@@@A)
code.lib(windebug.obj) : error LNK2019: unresolved external symbol "void __cdecl ade_stackdump(struct lua_State *,char *)" (?ade_stackdump@@YAXPAUlua_State@@PAD@Z) referenced in function "void __cdecl LuaError(struct lua_State *,char *,...)" (?LuaError@@YAXPAUlua_State@@PADZZ)
code.lib(windebug.obj) : error LNK2001: unresolved external symbol "struct lua_Debug Ade_debug_info" (?Ade_debug_info@@3Ulua_Debug@@A)
code.lib(scripting.obj) : error LNK2019: unresolved external symbol "public: int __thiscall script_state::CreateLuaState(void)" (?CreateLuaState@script_state@@QAEHXZ) referenced in function "void __cdecl script_init(void)" (?script_init@@YAXXZ)
code.lib(scripting.obj) : error LNK2019: unresolved external symbol "int __cdecl ade_set_object_with_breed(struct lua_State *,int)" (?ade_set_object_with_breed@@YAHPAUlua_State@@H@Z) referenced in function "public: void __thiscall script_state::SetHookObject(char *,int)" (?SetHookObject@script_state@@QAEXPADH@Z)
code.lib(scripting.obj) : error LNK2019: unresolved external symbol "int __cdecl ade_set_args(struct lua_State *,char *,...)" (?ade_set_args@@YAHPAUlua_State@@PADZZ) referenced in function "public: void __thiscall script_state::SetHookVar(char *,char,void *)" (?SetHookVar@script_state@@QAEXPADDPAX@Z)
code.lib(scripting.obj) : error LNK2019: unresolved external symbol "int __cdecl ade_get_args(struct lua_State *,char *,...)" (?ade_get_args@@YAHPAUlua_State@@PADZZ) referenced in function "public: bool __thiscall script_state::GetHookVar(char *,char,void *)" (?GetHookVar@script_state@@QAE_NPADDPAX@Z)
code.lib(scripting.obj) : error LNK2001: unresolved external symbol "bool Ade_get_args_lfunction" (?Ade_get_args_lfunction@@3_NA)
code.lib(scripting.obj) : error LNK2001: unresolved external symbol "int Ade_get_args_skip" (?Ade_get_args_skip@@3HA)
code.lib(scripting.obj) : error LNK2019: unresolved external symbol "int __cdecl ade_friendly_error(struct lua_State *)" (?ade_friendly_error@@YAHPAUlua_State@@@Z) referenced in function "private: int __thiscall script_state::RunBytecodeSub(int,int,char,void *)" (?RunBytecodeSub@script_state@@AAEHHHDPAX@Z)
code.lib(scripting.obj) : error LNK2019: unresolved external symbol "private: void __thiscall script_state::OutputLuaMeta(struct _iobuf *)" (?OutputLuaMeta@script_state@@AAEXPAU_iobuf@@@Z) referenced in function "public: int __thiscall script_state::OutputMeta(char *)" (?OutputMeta@script_state@@QAEHPAD@Z)
code.lib(collideweaponweapon.obj) : error LNK2001: unresolved external symbol "class ade_obj<struct object_h> l_Weapon" (?l_Weapon@@3V?$ade_obj@Uobject_h@@@@A)
code.lib(collidedebrisweapon.obj) : error LNK2001: unresolved external symbol "class ade_obj<struct object_h> l_Weapon" (?l_Weapon@@3V?$ade_obj@Uobject_h@@@@A)
code.lib(collideshipweapon.obj) : error LNK2019: unresolved external symbol "class ade_obj<struct object_h> l_Weapon" (?l_Weapon@@3V?$ade_obj@Uobject_h@@@@A) referenced in function "void __cdecl ship_weapon_do_hit_stuff(struct object *,struct object *,struct vec3d *,struct vec3d *,int,int,struct vec3d)" (?ship_weapon_do_hit_stuff@@YAXPAUobject@@0PAUvec3d@@1HHU2@@Z)
code.lib(collidedebrisship.obj) : error LNK2001: unresolved external symbol "class ade_obj<struct object_h> l_Debris" (?l_Debris@@3V?$ade_obj@Uobject_h@@@@A)
code.lib(collidedebrisweapon.obj) : error LNK2001: unresolved external symbol "class ade_obj<struct object_h> l_Debris" (?l_Debris@@3V?$ade_obj@Uobject_h@@@@A)
code.lib(collidedebrisship.obj) : error LNK2001: unresolved external symbol "class ade_obj<struct object_h> l_Asteroid" (?l_Asteroid@@3V?$ade_obj@Uobject_h@@@@A)
code.lib(collidedebrisweapon.obj) : error LNK2001: unresolved external symbol "class ade_obj<struct object_h> l_Asteroid" (?l_Asteroid@@3V?$ade_obj@Uobject_h@@@@A)
Debug\fs2_open_d.exe : fatal error LNK1120: 14 unresolved externals

Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: Getting FSO to compile with MSVS2005
Sounds like you're missing parse/lua.cpp or have USE_LUA disabled (If that's still in CVS).
-C

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: Getting FSO to compile with MSVS2005
Sounds like you're missing parse/lua.cpp or have USE_LUA disabled (If that's still in CVS).

Close. The project file thought they were in parse/scripting/ instead of just parse/. Trying another compile now.

EDIT: Nope. Still not working.
« Last Edit: June 24, 2007, 08:35:44 pm by Turey »
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Getting FSO to compile with MSVS2005
Hmm.  Seems I forgot to mention the existence of libjpeg.dsp and liblua.dsp, which produce dependencies just like code.dsp produces code.lib.

Also, I have no idea how to solve that browse info bug, but you can bypass it by disabling browse info on some (or all) of the projects.

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: Getting FSO to compile with MSVS2005
Hmm.  Seems I forgot to mention the existence of libjpeg.dsp and liblua.dsp, which produce dependencies just like code.dsp produces code.lib.
Way ahead of you, but same error.
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: Getting FSO to compile with MSVS2005
HAHA!

It took many, many hours of playing around with obscure, confusing project settings, but it finally compiles!

I've still got some testing and cleaning up to do, but expect a commit within 24 hours.

EDIT: Crap. And now, without changing anything, it doesn't work again.

EDIT2: I'm getting nowhere. Starting over with clean convert of MSVC 6 files, see if I can get back to a clean compile.
« Last Edit: June 27, 2007, 12:50:15 am by Turey »
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: Getting FSO to compile with MSVS2005
Alright, it compiles, but I had to rename either fs2_open/code/parse/lua.cpp or fs2_open/lua/lua.cpp to another name. How do I get this name change reflected in CVS?
« Last Edit: July 09, 2007, 09:58:05 pm by Turey »
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: Getting FSO to compile with MSVS2005
The version in CVS now compiles Debug without problems. I'm still working on release.
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline Stormkeeper

  • Interviewer Extraordinaire
  • 211
  • Boomz!
Re: Getting FSO to compile with MSVS2005
If vs2005 is giving errors from files that built properly on previous vs editions, or on other compilers, try checking the project options, and tinkering with the config settings. Generally, cuz those are all linking errors, tinkering around with those settings should work. You could also try changing it so that the project uses a multi-byte character set.
Ancient-Shivan War|Interview Board

Member of the Scooby Doo Fanclub. And we're not talking a cartoon dog here people!!

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: Getting FSO to compile with MSVS2005
If vs2005 is giving errors from files that built properly on previous vs editions, or on other compilers, try checking the project options, and tinkering with the config settings. Generally, cuz those are all linking errors, tinkering around with those settings should work. You could also try changing it so that the project uses a multi-byte character set.

Actually, the problem seems to be that MSVC2005 is just stupid, as it builds lua.obj from fs2_open/lua/lua.cpp, then builds a different lua.obj from fs2_open/code/parse/lua.cpp, then overwrites the first lua.obj with the second, and BAM! Unresolved externals. I tried changing the output folders, but it didn't seem to work.

The important part is that it compiles. IT can be cleaned up later.
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

  

Offline Backslash

  • 29
  • Bring Our Might To Bear
Re: Getting FSO to compile with MSVS2005
Well the other important part is that it runs, too...  ;)

I've been having your same struggles, and when I finally got the 3_6_9 branch to compile, it crashes upon game load.  No idea why, because I did get HEAD to work just fine.  I'll try your project settings to see if you've done anything different.

 

Offline Stormkeeper

  • Interviewer Extraordinaire
  • 211
  • Boomz!
Re: Getting FSO to compile with MSVS2005
Heh. That kind of problems a real pain. Idk why vs05 builds like that. Still can't figure it out.
Ancient-Shivan War|Interview Board

Member of the Scooby Doo Fanclub. And we're not talking a cartoon dog here people!!

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: Getting FSO to compile with MSVS2005
I've been having your same struggles, and when I finally got the 3_6_9 branch to compile, it crashes upon game load.  No idea why, because I did get HEAD to work just fine.  I'll try your project settings to see if you've done anything different.

I've found that I'm getting problems with malloc. I don't know why, it's not my code or my machine or even VC2005. It just randomly happens.
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline Stormkeeper

  • Interviewer Extraordinaire
  • 211
  • Boomz!
Re: Getting FSO to compile with MSVS2005
i doubt that errors will randomly happen. I'd try running through the code and see if all the variables are defined, cuz usually that causes 'random errors'.
Ancient-Shivan War|Interview Board

Member of the Scooby Doo Fanclub. And we're not talking a cartoon dog here people!!

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Getting FSO to compile with MSVS2005
The thing is that MSVC6 doesn't have these problems. I haven't had a malloc error in a couple of years.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Re: Getting FSO to compile with MSVS2005
current projects in CVS for MSCV2005 do not compile

(liblua)
LIB: fatal error LNK1181: cannot open input file '.\Debug\Profile\lua2.obj'
BSCMAKE: error BK1506 : cannot open file '.\debug\profile\lua\lua2.sbr': o such file or directory

(code)
LIB : fatal error LNK1811: cannot open input file '.\Debug\liblua_d.lib'

(Fred2)
LINK : fatal error LNK1104: cannot open file 'code.lib'
LINK : fatal error LNK1104: cannot open file '.\Debug\liblua_d.lib'

FRED2's link error is probably because code.lib isn't getting build because code.lib's build error

oh.. fred2 gets a billion warnings for
"WINVER not defined.  Defaulting to 0x0502 (Windows Server 2003)"

[edit]
i did add _CRT_NOSECURE_DEPRECIATE_ or whatever it is to all of the projects that needed it and commited

[edit2]
or not... my write access to the repo is disabled!
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: Getting FSO to compile with MSVS2005
current projects in CVS for MSCV2005 do not compile

(liblua)
LIB: fatal error LNK1181: cannot open input file '.\Debug\Profile\lua2.obj'
BSCMAKE: error BK1506 : cannot open file '.\debug\profile\lua\lua2.sbr': o such file or directory

(code)
LIB : fatal error LNK1811: cannot open input file '.\Debug\liblua_d.lib'

(Fred2)
LINK : fatal error LNK1104: cannot open file 'code.lib'
LINK : fatal error LNK1104: cannot open file '.\Debug\liblua_d.lib'

FRED2's link error is probably because code.lib isn't getting build because code.lib's build error

oh.. fred2 gets a billion warnings for
"WINVER not defined.  Defaulting to 0x0502 (Windows Server 2003)"

[edit]
i did add _CRT_NOSECURE_DEPRECIATE_ or whatever it is to all of the projects that needed it and commited

[edit2]
or not... my write access to the repo is disabled!

Try reading the readme next time. Rename fs2_open/lua/lua.cpp to lua2.cpp, otherwise it causes problems cause it has the same name as fs2_open/code/parse/lua.cpp.
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Re: Getting FSO to compile with MSVS2005
commit that to the repo
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline Backslash

  • 29
  • Bring Our Might To Bear
Re: Getting FSO to compile with MSVS2005
Why not rename code/parse/lua.cpp to parselua.cpp or something similar, instead of changing the lua.cpp in the sdk?