Page 1 of 1

Trouble with first compile

Posted: 01.04.2008, 20:22
by Epimetheus
I'm having trouble getting Celestia to compile in my environment. I've been following the instructions in this forum but noticed some of the posts are several years old and I'm stuck.

I'm using VS 2005 w/ .Net Framework 2.0 SP1 for development. I just installed the latest MS Platform SDK, but noticed that the directory structure is different from the environment var path examples I've seen here in this forum. I believe I've set all the INCLUDE, PATH and LIB vars. Do I need to install earlier versions of the Platform SDK and the 2003 Visual C++ Toolkit?!? I was getting a cannot find "LIBC.lib" file which doesn't even need to be linked to the app, but I added /NODEFAULTLIB compiler option to celestia.mak. Now, the compiler seems to be whining about some unresolved symbols regarding Lua. I included the error output from NMAKE.

Appreciate any help! :?

Code: Select all

   cd celutil
   nmake /NOLOGO util.mak MFLAGS=-MD CFG=Release
'.\Release\cel_utils.lib' is up-to-date
   cd ..
   cd celmath
   nmake /NOLOGO math.mak MFLAGS=-MD CFG=Release
'.\Release\cel_math.lib' is up-to-date
   cd ..
   cd cel3ds
   nmake /NOLOGO 3ds.mak MFLAGS=-MD CFG=Release
'.\Release\cel_3ds.lib' is up-to-date
   cd ..
   cd celtxf
   nmake /NOLOGO txf.mak MFLAGS=-MD CFG=Release
'.\Release\cel_txf.lib' is up-to-date
   cd ..
   cd celengine
   nmake /NOLOGO engine.mak MFLAGS=-MD CFG=Release SPICE= CELX=enable LUA_VER=0x050100
'.\Release\cel_engine.lib' is up-to-date
   cd ..
   cd celestia
   nmake /NOLOGO celestia.mak MFLAGS=-MD CFG=Release SPICE= CELX=enable LUA_VER=0x050100
   link.exe @C:\DOCUME~1\THOR~1\LOCALS~1\Temp\nmD9.tmp
celx.obj : error LNK2019: unresolved external symbol _lua_newtable referenced in function "void __cdecl CreateClassMetatable(struct lua_State *,int)" (?CreateClassMetatable@@YAXPAUlua_State@@H@Z)
cel_engine.lib(scriptorbit.obj) : error LNK2001: unresolved external symbol _lua_newtable
cel_engine.lib(scriptrotation.obj) : error LNK2001: unresolved external symbol _lua_newtable
celx.obj : error LNK2019: unresolved external symbol _lua_open referenced in function "public: __thiscall LuaState::LuaState(void)" (??0LuaState@@QAE@XZ)
celx.obj : error LNK2019: unresolved external symbol _lua_tostring referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall LuaState::getErrorMessage(void)" (?getErrorMessage@LuaState@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
cel_engine.lib(scriptorbit.obj) : error LNK2001: unresolved external symbol _lua_tostring
cel_engine.lib(scriptrotation.obj) : error LNK2001: unresolved external symbol _lua_tostring
.\Release\celestia.exe : fatal error LNK1120: 3 unresolved externals


Re: Trouble with first compile

Posted: 01.04.2008, 21:45
by selden
Please take a look at the Celestia WikiBook at http://en.wikibooks.org/wiki/Celestia/D ... 2_platform

Does that help?

Re: Trouble with first compile

Posted: 02.04.2008, 01:29
by Epimetheus
selden wrote:Please take a look at the Celestia WikiBook at http://en.wikibooks.org/wiki/Celestia/D ... 2_platform
Does that help?

Thanks for the reply. That page has been a big help. Unfortunately, I've got some kind of unresolved link issue with Lua objects. I'm stumped right now. Run makerelease and once it hits celestia.mak, things break down. I just downloaded this stuff a couple nights ago, so I'm sure I'm missing something. :?

Re: Trouble with first compile

Posted: 02.04.2008, 02:28
by chris
Have you tried using the Visual Studio project file to build Celestia?

--Chris

Re: Trouble with first compile

Posted: 02.04.2008, 07:13
by Epimetheus
chris wrote:Have you tried using the Visual Studio project file to build Celestia?

--Chris

Hey Chris,
Yes I have, and I had similar problems. I know I'm not including some lib or dll because I keep getting unresolved external link errors. I'm farther than I was. BTW, what is the proper location for Dlls? I've seen a few floating around in the distribution. Is the extern keyword being used a lot in this app?

Latest BrainFreeze :twisted:

Code: Select all

Compiling...
winstarbrowser.cpp
wintime.cpp
wintourguide.cpp
winviewoptsdlg.cpp
celx.cpp
Generating Code...
   link.exe @C:\DOCUME~1\THOR~1\LOCALS~1\Temp\nm362.tmp
celestiacore.obj : error LNK2019: unresolved external symbol "public: __thiscall PlanetographicGrid::PlanetographicGrid(class Body const &)" (??0PlanetographicGrid@@QAE@ABVBody@@@Z) referenced in function "public: void __thiscall CelestiaCore::toggleReferenceMark(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class Selection)" (?toggleReferenceMark@CelestiaCore@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VSelection@@@Z)
cspice.lib(lread.obj) : error LNK2001: unresolved external symbol _errno
...

Re: Trouble with first compile

Posted: 02.04.2008, 08:46
by cartrite
Did you do a svn update? It is now at r4234. It looks like you are using an older vcproj file that needs 3 new planetgrid files.
cartrite

Re: Trouble with first compile

Posted: 02.04.2008, 09:22
by t00fri
Epimetheus wrote:
chris wrote:Have you tried using the Visual Studio project file to build Celestia?

--Chris

Hey Chris,
Yes I have, and I had similar problems. I know I'm not including some lib or dll because I keep getting unresolved external link errors. I'm farther than I was. BTW, what is the proper location for Dlls? I've seen a few floating around in the distribution. Is the extern keyword being used a lot in this app?

Latest BrainFreeze :twisted:

Code: Select all

Compiling...
winstarbrowser.cpp
wintime.cpp
wintourguide.cpp
winviewoptsdlg.cpp
celx.cpp
Generating Code...
   link.exe @C:\DOCUME~1\THOR~1\LOCALS~1\Temp\nm362.tmp
celestiacore.obj : error LNK2019: unresolved external symbol "public: __thiscall PlanetographicGrid::PlanetographicGrid(class Body const &)" (??0PlanetographicGrid@@QAE@ABVBody@@@Z) referenced in function "public: void __thiscall CelestiaCore::toggleReferenceMark(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class Selection)" (?toggleReferenceMark@CelestiaCore@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VSelection@@@Z)
cspice.lib(lread.obj) : error LNK2001: unresolved external symbol _errno
...

It seems you are trying to win by means of a "random" strategy, which
does not look very promising ;-)

Your findings of unresolved external references is a perfectly usual
signature for cases, where some code that defines those external
references, is lacking to the Linker. Although that code may well be in
your collection of source files and headers, the compiler does NOT see
it, if you have not added these files to your workfiles/project files.

Anyone with a little experience in compilation matters will apply a
SYSTEMATIC procedure, to get rid of these unsatisfied externals.

Assuming that you have made all external libraries known to the
compiler already, the task is to look at your errors ONE-BY-ONE and
locate these files, where the unsatisfied references are defined, in your SOURCES.

For that purpose I use a powerful UNIX tool, called 'grep' (both in Linux
and Windows) that can search your code very quickly. Take as an
example your error, referring to 'PlanetographicGrid'. Go to your top
source directory and do

grep -r PlanetographicGrid *

This prints out right away what you (and your compiler!) are looking for,
the files where this object appears and notably where it is DEFINED:

celengine/planetgrid.h
celengine/planetgrid.cpp

You now add these two files to your project. I hope you know how to do
this! If not, READ the compiler docs...

Then you turn to the next error due to an unsatisfied external:

'toggleReferenceMark',

again do a 'grep' as above and you will find

celestia/celestiacore.h
celestia/celestiacore.cpp

...and so on...

within a few minutes this is all done and you can spend your time for
more sensible things... ;-)

If a library appears also in the context of an unsatisfied external error
(cspice.lib,...), you must of course make sure that the PATH to that
library and the corresponding include files is known to your
compiler/linker as well. Again such things are NOT related to Celestia,
but general know-how associated with using your compiler. So get
yourself a drink and look up your compiler manual in leisure. ;-)

Good luck,
F.

Re: Trouble with first compile

Posted: 02.04.2008, 10:10
by Epimetheus
Your points are all well-taken. I just started programming with C++ and Qt about a year ago. I haven't even touched any of the codebase yet. I'm just trying to get a successful build! Celestia is an awesome program and my hat is off to all the contributors and developers.

Good point on grep for windows, I just downloaded a utility.

Tschuss!

Re: Trouble with first compile

Posted: 02.04.2008, 10:12
by Epimetheus
cartrite wrote:Did you do a svn update? It is now at r4234. It looks like you are using an older vcproj file that needs 3 new planetgrid files.
cartrite

Thanks cartrite, I'll check into that!