简体   繁体   中英

In function ‘int main(int, char**), ‘MIN’ was not declared

I am working on Analysis code with ubuntu 18.04, HepMC 2.05.01, root 5.34.38, lhapdf 5.9.1. When i compile my code i got error;

g++ -g -I/home/danisih/compiler/analysis/pythia8153/include -I/home/danisih/compiler/analysis/TAUOLA.1.1.6c-LHC/include Analysistau.cc -o Analysistau.exe -L/home/danisih/compiler/analysis/TAUOLA.1.1.6c-LHC/lib  -L/home/danisih/compiler/analysis/pythia8153/lib/archive -L/home/danisih/compiler/analysis/HepMC-2.05.01/lib -L/home/danisih/compiler/analysis/lhapdf-5.9.1/lib `root-config --cflags --glibs` `fastjet-config --cxxflags --plugins` `fastjet-config --libs --plugins` -lpythia8 -lLHAPDF -lhepmcinterface -lHepMC -lTauolaCxxInterface -lTauolaFortran

Analysistau.cc: In function ‘int main(int, char**)’:

Analysistau.cc:221:16: error: ‘MIN’ was not declared in this scope

double max=MIN;
                ^

makefile:24: recipe for target 'Analysistau' failed

make: *** [Analysistau] Error 1

How to declare 'MIN' in int main()???

Since the case on MIN is all uppercase and the error looks intelligible I think that macros are giving you trouble.

Just add these lines before main:

double min(double a, double b){ return a<b ? a : b; }
double max(double a, double b){ return a>b ? a : b; }

It's best to avoid macros if you can.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM