Linking problems with VC++ 6.0 (solved)

Hi!

When buiding my program with VC++ 6.0, I get the following errors:

Linking... simu.obj : error LNK2001: unresolved external symbol "void __cdecl InitGui(void)" (?InitGui@@YAXXZ) simu.obj : error LNK2001: unresolved external symbol "public: __thiscall TROOT::TROOT(char const *,char const *,void (__cdecl**)(void))" (??0TROOT@@QAE@PBD0PAP6AXXZ@Z) simu.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall TROOT::~TROOT(void)" (??1TROOT@@UAE@XZ) Debug/simu.exe : fatal error LNK1120: 3 unresolved externals Error executing link.exe. simu.exe - 4 error(s), 0 warning(s)
Does anybody know what’s going wrong?

Thanks.

Hi berder,
see this web page: http://www.slac.stanford.edu/~gentit/cas/XPDebug.html. You probably did not add root’s libs in your project’s settings.
Axel.

Thank you for your help. I tried to follow each instruction step by step (even the VC++.NET configuration, although I’ve VC++ 6.0…), but the problem is still there.

Hi berder,
in that case we need more info: what does your code look like, and what does the build log look like? I need to know the command line for the linker, i.e. with what parameters is gets called. Another reason for missing symbols can be a missing implementation of a virtual method in your code…
Axel.

Hi!

In fact these are the initializing lines :extern void InitGui(); VoidFuncPtr_t initfuncs[] = { InitGui, 0 }; int Error; TROOT root("hello","hello", initfuncs); which cause the linking problem : I have put all the other lines in comment (if not, there are much more linking errors, always the same type).
I’m not sure if this is the kind of information you’d like to know about my linker command line, but in Project>Settings>Link, in the field “Common options”, there are : [ul]kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 [/ul]

You can remove these 4 statements from your application.
Since many years, the ROOT initialisation is automatic.

It looks like you have a problem with your PATH.

Rene

Hi berder,

Yepp, that’s it. Apart from Rene’s comment on the TROOT object you don’t need, you have to add libCore.lib libCint.lib libHist.lib libGraf.lib libGraf3d.lib libGpad.lib libTree.lib libRint.lib libPostscript.lib libMatrix.lib libPhysics.lib libGui.lib to the project’s link line. If you don’t have %ROOTSYS%\lib added to Visual Studio’s library path (in Settings / Options / Environment / Directories or something) prepend each of the above with their path, i.e. ‘c:\root\lib’ or wherever they are.

Axel.

IT WORKS!!!

Thank you very much, I don’t know how to thank you enough… I’ve ad the files to the project link line, and it starts a ROOT session and draw what it has to. My problem is solved.