# Creating ROOT program with Visual Studio

**URL:** <https://root-forum.cern.ch/t/creating-root-program-with-visual-studio/31962>\
**Category:** Newbie\
**Created:** [December 11, 2018, 1:22pm UTC](https://root-forum.cern.ch/t/creating-root-program-with-visual-studio/31962 "2018-12-11T13:22:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fateeff](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/e47774/32.png) [@fateeff](https://root-forum.cern.ch/u/fateeff)\
**Post date:** [December 11, 2018, 1:22pm UTC](https://root-forum.cern.ch/t/creating-root-program-with-visual-studio/31962/1 "2018-12-11T13:22:34Z")

</div>

Hello!  
I want to create a ROOT program with Visual Studio. I add includes and libraries from ROOT (all information I found here [https://twiki.cern.ch/twiki/bin/view/Sandbox/ROOTandVisualStudio](https://twiki.cern.ch/twiki/bin/view/Sandbox/ROOTandVisualStudio) ). Then I wrote this code:

```auto
#include <TApplication.h>
#include <TF1.h>
int main(int argc, char **argv)
{
TApplication theApp("App",&amp;argc,argv);
TF1 *f1 = new TF1("f1","sin(x)/x",0,gRandom-&gt;Rndm()*10);
theApp.Run();
return 0;
}

```

And I have: fatal error C1001: An internal error has occurred in the compiler in typetraits. hxx ( line 43)  
in this code:

```auto
struct CallableTraitsImpl<T, true> {
   using arg_types = typename CallableTraitsImpl<decltype(&T::operator())>::arg_types;
   using arg_types_nodecay = typename CallableTraitsImpl<decltype(&T::operator())>::arg_types_nodecay;
   using ret_type = typename CallableTraitsImpl<decltype(&T::operator())>::ret_type;
};

```

Please help me

---

<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:** [December 11, 2018, 1:35pm UTC](https://root-forum.cern.ch/t/creating-root-program-with-visual-studio/31962/2 "2018-12-11T13:35:02Z")

</div>

Hi,

Which **exact** version of Visual Studio are you using?

And BTW, it’s much simpler to use the command line, especially for very simple projects. For example, with your source being `main.cxx`:

```auto
cl -nologo -MD -GR -EHsc -I%ROOTSYS%\include -FIw32pragma.h main.cxx /link -LIBPATH:%ROOTSYS%\lib libCore.lib libHist.lib libGraf.lib libGpad.lib

```

Cheers, Bertrand.

---

<div class="post-metadata">

**Author:** ![fateeff](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/e47774/32.png) [@fateeff](https://root-forum.cern.ch/u/fateeff)\
**Post date:** [December 11, 2018, 1:46pm UTC](https://root-forum.cern.ch/t/creating-root-program-with-visual-studio/31962/3 "2018-12-11T13:46:56Z")

</div>

Version of Visual Studio: Visual Studio Community 2017 15.9.3

---

<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:** [December 11, 2018, 1:51pm UTC](https://root-forum.cern.ch/t/creating-root-program-with-visual-studio/31962/4 "2018-12-11T13:51:22Z")

</div>

OK, there is at lease one problem with this version of Visual Studio. The compiler contains a bug, as you can see on [this bug report](https://developercommunity.visualstudio.com/content/problem/335088/fatal-error-c1001-an-internal-error-has-occurred-i-24.html). The last working version is 15.7.6

---

<div class="post-metadata">

**Author:** ![fateeff](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/e47774/32.png) [@fateeff](https://root-forum.cern.ch/u/fateeff)\
**Post date:** [December 12, 2018, 8:52am UTC](https://root-forum.cern.ch/t/creating-root-program-with-visual-studio/31962/5 "2018-12-12T08:52:31Z")

</div>

After installing version 15.7.6 apperared error:

C4996 ‘std::copy::\_Unchecked\_iterators::\_Deprecate’: Call to ‘std::copy’ with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D\_SCL\_SECURE\_NO\_WARNINGS. See documentation on how to use Visual C++ ‘Checked Iterators’ root\_c\_15\_6\_7 c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.14.26428\include\xutility 2483

---

<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:** [December 12, 2018, 8:54am UTC](https://root-forum.cern.ch/t/creating-root-program-with-visual-studio/31962/6 "2018-12-12T08:54:51Z")

</div>

Don’t worry, it’s not an error, it’s a warning…
