Error when I try to rerun a macro with std::stringstream'

Hi, I have this macro:

ProvaErrore.C (524 Bytes)

that read this file:

DatiMemoria.txt (1004 Bytes)

If I try to run it the first time with .x ProvaErrore.C everything is fine. But if I try to rerun it I have this error:

 error: no matching constructor for initialization of 'std::stringstream' (aka 'basic_stringstream<char, char_traits<char>, allocator<char> >')
                stringstream ss(line1);
                             ^  ~~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include\sstream:531:14: note: candidate constructor not viable: no known conversion from 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') to 'ios_base::openmode' (aka 'int') for 1st argument
    explicit basic_stringstream(ios_base::openmode _Mode = ios_base::in | ios_base::out)
             ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include\sstream:539:5: note: candidate constructor not viable: no known conversion from 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') to 'std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >' for
      1st argument
    basic_stringstream(basic_stringstream&& _Right) : _Mybase(&_Stringbuffer) { // construct by moving _Right
    ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include\sstream:562:5: note: candidate constructor not viable: no known conversion from 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') to 'const std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >'
      for 1st argument
    basic_stringstream(const basic_stringstream&) = delete;

I am using root on Windows 10 with visual studio 2019

Which version of ROOT?

ROOT 6.18/04 . Look at this question bellenot, probably is linked with that one:

In general, one cannot run a macro twice (unloading issue). But I have no problem running your macro several times with the master:

**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.3.4
** Copyright (c) 2019 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86'

C:\Users\sftnight>build\debug\bin\thisroot.bat

C:\Users\sftnight>cd rootdev

C:\Users\sftnight\rootdev>root -l
root [0] .x ProvaErrore.C
root [1] .x ProvaErrore.C
root [2] .x ProvaErrore.C
root [3] .q

C:\Users\sftnight\rootdev>

And I confirm it doesn’t work with 6.18.04

I guess it is similar to what is reported in this bug report.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.