Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TMVA headers must be included before TODBCServer.h to avoid compile error in TVirtualTreePlayer.h(45,75): error C2589: '(': illegal token on right side of '::' #16638

Open
1 task
osl3 opened this issue Oct 8, 2024 · 1 comment
Assignees
Labels

Comments

@osl3
Copy link

osl3 commented Oct 8, 2024

Check duplicate issues.

  • Checked for duplicates

Description

My Windows 11 program compiles and runs when the '#include "TMVA/Factory.h"' statement precedes the '#include "TODBCResult.h"' statement, and fails to compile as below when the order is reversed:

1>------ Build started: Project: RootGrapher, Configuration: Debug x64 ------
1>RootGrapher.cpp
1>E:\dev\root_build\include\TArrayL64.h(45,61): warning C4244: 'return': conversion from 'Long64_t' to 'Double_t', possible loss of data
1>(compiling source file 'RootGrapher.cpp')
1>E:\dev\root_build\include\TVirtualTreePlayer.h(45,75): warning C4003: not enough arguments for function-like macro invocation 'max'
1>(compiling source file 'RootGrapher.cpp')
1>E:\dev\root_build\include\TVirtualTreePlayer.h(45,75): error C2589: '(': illegal token on right side of '::'
1>(compiling source file 'RootGrapher.cpp')
1>E:\dev\root_build\include\TVirtualTreePlayer.h(45,44): error C2062: type 'unknown-type' unexpected
1>(compiling source file 'RootGrapher.cpp')
1>E:\dev\root_build\include\TVirtualTreePlayer.h(45,42): error C2789: 'TVirtualTreePlayer::kMaxEntries': an object of const-qualified type must be initialized
1>(compiling source file 'RootGrapher.cpp')
1> E:\dev\root_build\include\TVirtualTreePlayer.h(45,30):
1> see declaration of 'TVirtualTreePlayer::kMaxEntries'
1>E:\dev\root_build\include\TVirtualTreePlayer.h(45,75): error C2059: syntax error: ')'
1>(compiling source file 'RootGrapher.cpp')
1>E:\dev\root_build\include\TTree.h(229,64): error C2131: expression did not evaluate to a constant
1>(compiling source file 'RootGrapher.cpp')
1> E:\dev\root_build\include\TTree.h(229,64):
1> failure was caused by a read of an uninitialized symbol
1> E:\dev\root_build\include\TTree.h(229,64):
1> see usage of 'kMaxEntries'

Reproducer

put this in a cpp file and compile it to see the error:

#include
#include <gsl\gsl>
#include "TF1.h"
#include "TH1F.h"
#include "TApplication.h"
#include <TAxis.h>
#include "TCanvas.h"
#include "TDatime.h"
#include "TFrame.h"
#include "TGraph.h"
#include "TMultiGraph.h"
#include "TRootCanvas.h"

#include "TODBCServer.h"
// TMVA seems to compile only when before TODBCServer.h
#include "TMVA/Factory.h"

ROOT version


| Welcome to ROOT 6.32.06 https://root.cern |
| (c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for win64 on Oct 07 2024, 17:23:18 |
| From tags/6-32-06@6-32-06 |
| With MSVC 19.41.34120.0 |
| Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |

Welcome to the ROOT tutorials

Type ".x demos.C" to get a toolbar from which to execute the demos

Type ".x demoshelp.C" to see the help window

==> Many tutorials use the file hsimple.root produced by hsimple.C
==> It is recommended to execute hsimple.C before any other script

Taking a break from ROOT? Hope to see you back!

Installation method

N/A

Operating system

Windows 11

Additional context

No response

@bellenot
Copy link
Member

bellenot commented Oct 15, 2024

Can you try to add the /DNOMINMAX compilation flag and try again?
And check also the output of root-config --cflags:

C:\root-dev\rootdev>root-config --cflags
-nologo  -Zc:__cplusplus -std:c++17 -GR -FIw32pragma.h -FIsehmap.h -MD -EHsc -wd4141 -wd4291 -wd4244 -wd4049 -wd4146 -wd4250 -wd4624 -wd4267 -D_XKEYCHECK_H -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING -D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING  -O2 -IC:\root-dev\build\x64\release\include

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants