[ROOT] Compiling Tutorials for ROOT on Win7, x64, VStudio10

Dear ROOT- People,

I’m new to ROOT, and need to program some High-Speed-Camera-Interface hier at the COSY in Jülich.

Therefore I managed to Build Root, on my Win7 (x64 Platform) by compiling the ROOT Sourcecode 5.29 . So far everthing is running. Cint works just fine.

Now I want to compile the hsimple.cxx to try my first ROOT-compiled-Programm, and later manipulate it in the way I need it.

— I created a new Win32 Project, by the following steps:

– Openning the hsimple.cxx with VS2010, and choose, File/Adding to a new Projekt :
– I choose a standard Win32-Console Project.

– Now I replaced the empty _tmain by the hsimple.cxx Code;

– in The Prjekt Propertys I added “c:\ROOT\include” to the include-directory
– As well as: c:\ROOT\lib to the library-directory
– Than I Transfered the Projekt to an x64 Projekt, to be compatible with my Platform.

– But, whatever I tried, everytime I get this Linker errors…

OUTPUT__________________________________________________________________________________
1>------ Erstellen gestartet: Projekt: MyOwnHSimple, Konfiguration: Debug x64 ------
1>Der Buildvorgang wurde am 10.05.2011 14:48:40 gestartet.
1>InitializeBuildStatus:
1> “x64\Debug\MyOwnHSimple.unsuccessfulbuild” wird erstellt, da “AlwaysCreate” angegeben wurde.
1>ClCompile:
1> stdafx.cpp
1> MyOwnHSimple.cpp
1>c:\root\include\TString.h(450): warning C4267: ‘Argument’: Konvertierung von ‘size_t’ nach ‘Ssiz_t’, Datenverlust möglich
1>c:\root\include\TString.h(462): warning C4267: ‘Argument’: Konvertierung von ‘size_t’ nach ‘Ssiz_t’, Datenverlust möglich
1>c:\root\include\TString.h(471): warning C4996: ‘sprintf’: This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(371): Siehe Deklaration von ‘sprintf’
1>c:\root\include\TString.h(474): warning C4996: ‘sprintf’: This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(371): Siehe Deklaration von ‘sprintf’
1>c:\root\include\TString.h(489): warning C4996: ‘sprintf’: This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(371): Siehe Deklaration von ‘sprintf’
1>c:\root\include\TString.h(495): warning C4996: ‘sprintf’: This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(371): Siehe Deklaration von ‘sprintf’
1>c:\root\include\TString.h(498): warning C4996: ‘sprintf’: This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(371): Siehe Deklaration von ‘sprintf’
1>c:\root\include\TString.h(501): warning C4267: ‘Argument’: Konvertierung von ‘size_t’ nach ‘Ssiz_t’, Datenverlust möglich
1>c:\root\include\TString.h(510): warning C4267: ‘Argument’: Konvertierung von ‘size_t’ nach ‘Ssiz_t’, Datenverlust möglich
1>c:\root\include\TString.h(519): warning C4267: ‘Argument’: Konvertierung von ‘size_t’ nach ‘Ssiz_t’, Datenverlust möglich
1>c:\root\include\TString.h(529): warning C4267: ‘Argument’: Konvertierung von ‘size_t’ nach ‘Ssiz_t’, Datenverlust möglich
1>c:\root\include\TString.h(541): warning C4267: ‘Argument’: Konvertierung von ‘size_t’ nach ‘Ssiz_t’, Datenverlust möglich
1>c:\root\include\TString.h(562): warning C4267: ‘Argument’: Konvertierung von ‘size_t’ nach ‘Ssiz_t’, Datenverlust möglich
1>c:\root\include\TString.h(575): warning C4267: ‘Argument’: Konvertierung von ‘size_t’ nach ‘Ssiz_t’, Datenverlust möglich
1>c:\root\include\TString.h(578): warning C4267: ‘Argument’: Konvertierung von ‘size_t’ nach ‘Ssiz_t’, Datenverlust möglich
1>c:\root\include\TString.h(581): warning C4267: ‘Argument’: Konvertierung von ‘size_t’ nach ‘Ssiz_t’, Datenverlust möglich
1>c:\root\include\TString.h(581): warning C4267: ‘Argument’: Konvertierung von ‘size_t’ nach ‘Ssiz_t’, Datenverlust möglich
1>MyOwnHSimple.cpp(59): warning C4244: ‘Initialisierung’: Konvertierung von ‘Double_t’ in ‘Float_t’, möglicher Datenverlust
1>MyOwnHSimple.cpp(63): warning C4244: ‘Argument’: Konvertierung von ‘Int_t’ in ‘Float_t’, möglicher Datenverlust
1>MyOwnHSimple.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ““public: static void __cdecl TObject::operator delete(void *)” (??3TObject@@SAXPEAX@Z)” in Funktion ““int int __cdecl hsimple(void)'::1’::dtor$1” (?dtor$1@?0??hsimple@@YAHXZ@4HA)”.
1>MyOwnHSimple.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ““public: virtual __cdecl TFile::~TFile(void)” (??1TFile@@UEAA@XZ)” in Funktion ““int __cdecl hsimple(void)” (?hsimple@@YAHXZ)”.
1>MyOwnHSimple.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ““public: virtual void __cdecl TFile::Close(char const *)” (?Close@TFile@@UEAAXPEBD@Z)” in Funktion ““int __cdecl hsimple(void)” (?hsimple@@YAHXZ)”.
1>MyOwnHSimple.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ““public: virtual int __cdecl TFile::Write(char const *,int,int)” (?Write@TFile@@UEAAHPEBDHH@Z)” in Funktion ““int __cdecl hsimple(void)” (?hsimple@@YAHXZ)”.
1>MyOwnHSimple.obj : error LNK2001: Nicht aufgelöstes externes Symbol “”__declspec(dllimport) class TRandom * gRandom" (_imp?gRandom@@3PEAVTRandom@@EA)".
1>MyOwnHSimple.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ““public: __cdecl TNtuple::TNtuple(char const *,char const *,char const *,int)” (??0TNtuple@@QEAA@PEBD00H@Z)” in Funktion ““int __cdecl hsimple(void)” (?hsimple@@YAHXZ)”.
1>MyOwnHSimple.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ““public: __cdecl TProfile::TProfile(char const *,char const *,int,double,double,double,double,char const *)” (??0TProfile@@QEAA@PEBD0HNNNN0@Z)” in Funktion ““int __cdecl hsimple(void)” (?hsimple@@YAHXZ)”.
1>MyOwnHSimple.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ““public: __cdecl TH2F::TH2F(char const *,char const *,int,double,double,int,double,double)” (??0TH2F@@QEAA@PEBD0HNNHNN@Z)” in Funktion ““int __cdecl hsimple(void)” (?hsimple@@YAHXZ)”.
1>MyOwnHSimple.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ““public: __cdecl TH1F::TH1F(char const *,char const *,int,double,double)” (??0TH1F@@QEAA@PEBD0HNN@Z)” in Funktion ““int __cdecl hsimple(void)” (?hsimple@@YAHXZ)”.
1>MyOwnHSimple.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ““public: __cdecl TFile::TFile(char const *,char const *,char const *,int)” (??0TFile@@QEAA@PEBD00H@Z)” in Funktion ““int __cdecl hsimple(void)” (?hsimple@@YAHXZ)”.
1>MyOwnHSimple.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ““public: static void * __cdecl TStorage::ObjectAlloc(unsigned __int64)” (?ObjectAlloc@TStorage@@SAPEAX_K@Z)” in Funktion ““public: static void * __cdecl TObject::operator new(unsigned __int64)” (??2TObject@@SAPEAX_K@Z)”.
1>MyOwnHSimple.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ““public: __cdecl TVersionCheck::TVersionCheck(int)” (??0TVersionCheck@@QEAA@H@Z)” in Funktion ““void __cdecl `dynamic initializer for ‘gVersionCheck’’(void)” (??__EgVersionCheck@@YAXXZ)”.
1>x64\Debug\MyOwnHSimple.exe : fatal error LNK1120: 12 nicht aufgelöste externe Verweise.
1>
1>Fehler beim Erstellen
1>
1>Verstrichene Zeit 00:00:01.40
========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========


Is there any detailed Tutorial for this Problem, or. “How to run hsimple.cxx in VStudio2010” - I couldn’t find it. Or How to start to compile Root Examples with Visual Studio 2010. :unamused:

I’d be greatefull for your help and suggestions. [-o<

Nice Greetings from Jülich,

Johann Elis

PS: One can call me directly, or open a Remote Control Session, if the answer is more complicated. :neutral_face:


Johann C. Elis
IKP-2
Forschungszentrum Jülich
52425 Jülich
+49 (246161) 3278


Hi Johann,

You have to link your project with the Root libraries (you can safely add all the *.lib files from $ROOTSYS/lib)

Cheers, Bertrand.

[SOLVED]

Hey Bertran,

I did linked, by putting $ROOTSYS\lib;%(AdditionalLibraryDirectories) into the PrjektPropertys/Linker/Library-Directory…

Anway, I read http://techday.com.ua/en/software/188-root-compilation.html again, and found the “wolfschu”-Example *.vcxproj - Projekt:

http://techday.com.ua/images/stories/root_framework/wolfschu.tar.gz

It worked right away and perfekt!!!

Except that I couldn’t kovnert it from the Win32 Plattform to a x64 Platform because of the same nasty Linker Errors:

1>------ Erstellen gestartet: Projekt: wolfschu, Konfiguration: Debug x64 ------ 1>Der Buildvorgang wurde am 11.05.2011 16:37:11 gestartet. 1>InitializeBuildStatus: 1> Aktualisieren des Timestamps von "Debug\wolfschu.unsuccessfulbuild". 1>ClCompile: 1> Alle Ausgaben sind aktuell. 1>ManifestResourceCompile: 1> Alle Ausgaben sind aktuell. 1>wolfschu.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: static void __cdecl TObject::operator delete(void *)" (??3TObject@@SAXPEAX@Z)" in Funktion "main$dtor$1". 1>wolfschu.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: virtual __cdecl TApplication::~TApplication(void)" (??1TApplication@@UEAA@XZ)" in Funktion "main". 1>wolfschu.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: virtual void __cdecl TApplication::Run(bool)" (?Run@TApplication@@UEAAX_N@Z)" in Funktion "main". 1>wolfschu.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""__declspec(dllimport) class TSystem * gSystem" (__imp_?gSystem@@3PEAVTSystem@@EA)". 1>wolfschu.obj : error LNK2001: Nicht aufgelöstes externes Symbol ""__declspec(dllimport) class TRandom * gRandom" (__imp_?gRandom@@3PEAVTRandom@@EA)". 1>wolfschu.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __cdecl TH1F::TH1F(char const *,char const *,int,double,double)" (??0TH1F@@QEAA@PEBD0HNN@Z)" in Funktion "main". 1>wolfschu.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __cdecl TCanvas::TCanvas(char const *,char const *,int,int,int,int)" (??0TCanvas@@QEAA@PEBD0HHHH@Z)" in Funktion "main". 1>wolfschu.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __cdecl TApplication::TApplication(char const *,int *,char * *,void *,int)" (??0TApplication@@QEAA@PEBDPEAHPEAPEADPEAXH@Z)" in Funktion "main". 1>wolfschu.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: static void * __cdecl TStorage::ObjectAlloc(unsigned __int64)" (?ObjectAlloc@TStorage@@SAPEAX_K@Z)" in Funktion ""public: static void * __cdecl TObject::operator new(unsigned __int64)" (??2TObject@@SAPEAX_K@Z)". 1>wolfschu.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __cdecl TVersionCheck::TVersionCheck(int)" (??0TVersionCheck@@QEAA@H@Z)" in Funktion ""void __cdecl `dynamic initializer for 'gVersionCheck''(void)" (??__EgVersionCheck@@YAXXZ)". 1>C:\Users\win72\Downloads\wolfschu\wolfschu\Debug\wolfschu.exe : fatal error LNK1120: 10 nicht aufgelöste externe Verweise. 1> 1>Fehler beim Erstellen 1> 1>Verstrichene Zeit 00:00:00.19 ========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========

I want to ecourage you to put those examples to the ROOT website.
It made me very happy. :smiley:

Thanks for your support!!!
I’m looking forward to work with ROOT!!!

Au Revoir, Johann

Dear Johann,

Just a couple of details:
[ul]

  1. There is no 64 bit (x64) ROOT build for the time being (it is not yet supported). This means you cannot build your project in 64 bit mode (but no problem with 32 bit).
  2. Adding $ROOTSYS\lib in your library directory is not sufficient. You have to explicitely link with the ROOT libraries by adding libCore.lib, libHist.lib, … (all the files in $ROOTSYS/lib) in the “Additional Dependencies” field of “Configuration Properties/Linker/Input”
    [/ul]
    If you cannot solve your problem, feel free to attach your full project files (zipped), I’ll take a look.

Cheers, Bertrand.