2 unresolved externals

Hi Root Support,
I have this error below in the console:

Error LNK2001 unresolved external symbol “public: virtual void __thiscall TGFrame::SendMessageW(class TGWindow const *,long,long,long)” (?SendMessageW@TGFrame@@UAEXPBVTGWindow@@JJJ@Z)
This error I believe is to do with the ‘Input’ configuration properties under ‘Linker’.
What I tried to do was enter the ‘TGFrame’ lib file for the ‘Additional Dependencies’ Which should be within my ‘lib’ file directory under ‘ROOT’. But it is not there so how can I add it if it is not there? Do I need to install something? Because this was how I fixed other errors that were similar to the error above.

The top error is followed by this error:

Error LNK2001 unresolved external symbol “void __cdecl AcquisitionLoop(void)” (?AcquisitionLoop@@YAXXZ)

For this error I am not too sure what it means because before when my whole source file code was structured without object oriented design and it was not modular. I went ahead to redesign the source, and I kept getting errors after errors. From Root dictionary generation errors to rearranging Root library classes like TGMainFrame, TH1F etc.

Much help will be appreciated, thanks.

MT

Hi,

[quote=“Mostarba”]Error LNK2001 unresolved external symbol “public: virtual void __thiscall TGFrame::SendMessageW(class TGWindow const *,long,long,long)” (?SendMessageW@TGFrame@@UAEXPBVTGWindow@@JJJ@Z)
This error I believe is to do with the ‘Input’ configuration properties under ‘Linker’.
What I tried to do was enter the ‘TGFrame’ lib file for the ‘Additional Dependencies’ Which should be within my ‘lib’ file directory under ‘ROOT’. But it is not there so how can I add it if it is not there? Do I need to install something? Because this was how I fixed other errors that were similar to the error above.[/quote]
Try to add all the libraries present in $(ROOTSYS)/lib. The linker will pick the required ones (the one you need is libGui.lib).

And about this one:

[quote=“Mostarba”]Error LNK2001 unresolved external symbol “void __cdecl AcquisitionLoop(void)” (?AcquisitionLoop@@YAXXZ)
[/quote]
It is from your own code, so you probably missing a library, or an object file, or you didn’t export the symbol, or…

Cheers, Bertrand.

I have did this once, but not for every lib files I think. The first lib file that I input was libGui.lib. It gave the same error. Right now the libGUI is still in the AD but giving the error.
Will try again adding all the lib files, is there a way to have access with everything inside the lib file? for e.g. in command line it will be easy with a simple: lib/*
It will be a hassle to add all files manually.

Sorry, I overlooked your first post. In fact, you should simply add

In your code, where you invoke ROOT Gui classes.
And no, you cannot use wildcard (*.lib)

Yep,

this helped remove the error for this:
Error LNK2001 unresolved external symbol “public: virtual void __thiscall TGFrame::SendMessageW(class TGWindow const *,long,long,long)” (?SendMessageW@TGFrame@@UAEXPBVTGWindow@@JJJ@Z

For the other error:
Error LNK2001 unresolved external symbol “void __cdecl AcquisitionLoop(void)” (?AcquisitionLoop@@YAXXZ)

is still here.

Also, when I entered all the lib files for the AD, i get another error:
Error LNK2001 unresolved external symbol “public: __thiscall TFile::TFile(char const *,char const *,char const *,int)” (??0TFile@@QAE@PBD00H@Z)

This error is probably with the lib file that I included, one of them not needed or something?

Thanks
MT

As I said, this is coming from your own code, and there is nothing we can do about it…

Well, this is weird… Are you using TFile? Is libRIO.lib included in the list of libraries?

Oh wow, thanks a lot.
libRIO helped fix the error.

How is it that you knew which lib file is for what include?

MT

Well, I know because I’m a ROOT developer (and TFile is part of the I/O subsystem and libRIO means lib ROOT I/O) :wink:
More seriously, our previous documentation system was telling, for every class, which library to link with (i.e. which library was containing that class). But unfortunately it looks like Doxygen doesn’t have this feature…
So that’s why I told you to simply add the complete list of libraries (you can copy/paste anyway)

haha :smiley:
I feel stupid for not knowing that now. Because I went ahead and copy their name and pasted them individually to AD and then adding $(ROOTSYS)/lib_inserthere_.lib
took me long.

Made me think that I could possibly automate this hard copy and pasting. Not sure if Visual Studios has this feature. Even if I could code this then how could I even add it to Visual Studios. Cant we all have the same Editor but a little section that allows us to make a feature within Visual Studios. I dont know if this kind of thing is good.

Sorry for babbling on, I like to think. Thanks for your help,
MT