I am trying to compile the simple example in Visual Studio 2022. Windows 10, Root just installed yesterday: 6.26/06. I created a console project in Visual Studio and then added the include path to the project include settings and the library path to the project library settings. It compiles correctly but gives the 2 linker errors:
Severity
Code
Description
Project
File
Line
Suppression State
Error
C2445
result type of conditional expression is ambiguous: types ‘TString’ and ‘const char [1]’ can be converted to multiple common types
roottestplot
C:\Program Files\rootfiles\root\include\TF1.h
463
Error
C4996
‘std::iterator<std::bidirectional_iterator_tag,TObject *,ptrdiff_t,const TObject **,const TObject *&>’: warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.
I am still getting the same C2445 error in Visual Studio with release 6.26/10. The C4996 error no longer occurs when trying to compile your basic example.
Severity Code Description Project File Line Suppression State
Error C2445 result type of conditional expression is ambiguous: types ‘TString’ and ‘const char [1]’ can be converted to multiple common types roottestplot C:\root_v6.26.10\include\TF1.h 463
The compile switches seem to be /RTC1 /Gd /permissive- /EHsc /Gm- /fp:precise /ZcforScope
OK, so I suppose you build from inside Visual Studio, right? Can you try to compile on the Visual Studio command prompt corresponding to your version of Visual Studio (what I was asking for) and for the architecture you’re building with this command:
OK, so open a x86 Native Tools Command Prompt for VS 2022 for 32 bit build, or a x64 Native Tools Command Prompt for VS 2022 for 64 build, and after calling thisroot.bat (in the bin directory of where you installed ROOT), type the command I posted previously