# LNK2019 and LNK1120

**URL:** <https://root-forum.cern.ch/t/lnk2019-and-lnk1120/49866>\
**Category:** Newbie\
**Created:** [May 5, 2022, 8:16am UTC](https://root-forum.cern.ch/t/lnk2019-and-lnk1120/49866 "2022-05-05T08:16:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr.WhatZitToYa](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@Mr.WhatZitToYa](https://root-forum.cern.ch/u/Mr.WhatZitToYa)\
**Post date:** [May 5, 2022, 8:16am UTC](https://root-forum.cern.ch/t/lnk2019-and-lnk1120/49866/1 "2022-05-05T08:16:19Z")

</div>

Hello dear root community,

I have recently started working with root, but I have a lot of C++ experience. I searched the forum for simular problems, but they wern’t any solutions that solved my problem. I am trying to to Compile one of my Macros with the 64 bit cl.exe compiler but there are always linking errors (it compiles but doesn’t link). I am running the following command in the x64 Developer Command Prompt:

cl -std:c++17 -nologo -MD -GR -EHsc Compiling\_test.cxx -I C:\root\_v6.26.02\include /link -LIBPATH:C:\root\_v6.26.02\lib libCore.lib libGpad.lib libHist.lib

I changed the file ending to .cxx, wrote a main function and included all the appropriate Header Files. (#include “TStopwatch.h” and #include “TRandom3.h”). I am very confident it’s not a problem of the source code. If i remove TRanddom3.h and its elemets it even works, but if I add more Headers i get more Linking errors, thus I conclude that my comand is missing the appropriate .lib files to include all that stuff. I looked at the folder but I just cannot figure out which files I have to include. Writing \*.lib doesn’t work and I just get more errors.

The error is btw: Compiling\_test.obj : error LNK2019: unresolved external symbol “public: \_\_cdecl TRandom3::TRandom3(unsigned int)” (??0TRandom3@@QEAA@I@Z) referenced in function main  
Compiling\_test.exe : fatal error LNK1120: 1 unresolved externals

I would really appreciate some help 🙂  
with best regards  
Nikita

* * *

_ROOT Version:_ root\_v6.26.02 (64 bit)  
_Platform:_ Windows 10  
_Compiler:_ 64x cl.exe

* * *

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [May 5, 2022, 8:33am UTC](https://root-forum.cern.ch/t/lnk2019-and-lnk1120/49866/2 "2022-05-05T08:33:01Z")

</div>

Welcome to the ROOT Forum!  
Add `libMathCore.lib` . See at the end of [ROOT: TRandom3 Class Reference](https://root.cern.ch/doc/master/classTRandom3.html)

---

<div class="post-metadata">

**Author:** ![Mr.WhatZitToYa](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@Mr.WhatZitToYa](https://root-forum.cern.ch/u/Mr.WhatZitToYa)\
**Post date:** [May 5, 2022, 8:56am UTC](https://root-forum.cern.ch/t/lnk2019-and-lnk1120/49866/3 "2022-05-05T08:56:34Z")

</div>

Hi,

thank you for the quick anwser. I wasn’t aware, that there is a dependency table at the end of each header reference. Everything works now. Thank you very much!

with best regards,  
Nikita
