简体   繁体   English

在 function 'int main(int, char**), 'MIN' 没有声明

[英]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.我正在使用 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()???如何在 int main() 中声明“MIN”???

Since the case on MIN is all uppercase and the error looks intelligible I think that macros are giving you trouble.由于 MIN 的大小写都是大写的,而且错误看起来很容易理解,我认为宏给你带来了麻烦。

Just add these lines before main:只需在 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.如果可以的话,最好避免使用宏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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