RangeNetworks / OpenBTS-UMTS

3G UMTS Data Radio Access Network Node
GNU Affero General Public License v3.0
297 stars 196 forks source link

Compilation fails with error: 'constexpr' needed for in-class initialization of static data member #25

Open mike01 opened 5 years ago

mike01 commented 5 years ago

When compiling via "make" the following error message appears:

In file included from ../TRXManager/TRXManager.h:30:0, from ../UMTS/UMTSL1CC.h:28, from ../UMTS/UMTSL1FEC.h:28, from ../UMTS/UMTSConfig.h:30, from CLI.cpp:31: ../UMTS/UMTSRadioModem.h: At global scope: ../UMTS/UMTSRadioModem.h:181:28: error: 'constexpr' needed for in-class initialization of static data member 'const float UMTS::RadioModem::mRACHThreshold' of non-integral type [-fpermissive] static const float mRACHThreshold = 10.0; ^~~~~~ CLI.cpp: In function 'CommandLine::CLIStatus CommandLine::sendsimple(int, char**, std::ostream&)': CLI.cpp:480:137: warning: format '%u' expects argument of type 'unsigned int', but argument 13 has type 'size_t {aka long unsigned int' [-Wformat=] SI, (unsigned)random(), srcAddr,srcAddr,sock.port(),(unsigned)random(), IMSI, (unsigned)random(),sock.port(), strlen(txtBuf), txtBuf);


CLI.cpp: At global scope:
CLI.cpp:270:18: warning: 'CommandLine::CLIStatus CommandLine::printStats(int, char**, std::ostream&)' declared 'static' but never defined [-Wunused-function]
 static CLIStatus printStats(int argc, char** argv, ostream& os);
                  ^~~~~~~~~~
CLI.cpp:1092:18: warning: 'CommandLine::CLIStatus CommandLine::endcall(int, char**, std::ostream&)' defined but not used [-Wunused-function]
 static CLIStatus endcall(int argc, char **argv, ostream& os)
                  ^~~~~~~
CLI.cpp:370:20: warning: 'CommandLine::tmsisHelp' defined but not used [-Wunused-variable]
 static const char *tmsisHelp = "[-l | clear | dump [-l] <filename> | -delete -tmsi <tmsi> | -delete -imsi <imsi> | -query <query>] --\n"
                    ^~~~~~~~~
CLI.cpp:231:27: warning: 'std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > CommandLine::cliParse(int&, char**&, std::ostream&, const char*)' defined but not used [-Wunused-function]
 static map<string,string> cliParse(int &argc, char **&argv, ostream &os, const char *optstring)
                           ^~~~~~~~
make[2]: *** [Makefile:500: CLI.lo] Error 1
make[2]: Leaving directory '/home/mike/folder/progs/openbts_3g_v1/OpenBTS-UMTS/CLI'
make[1]: *** [Makefile:549: all-recursive] Error 1
make[1]: Leaving directory '/home/mike/folder/progs/openbts_3g_v1/OpenBTS-UMTS'
make: *** [Makefile:480: all] Error 2
vandong123 commented 5 years ago

../UMTS/UMTSRadioModem.h:181:16: error: ‘constexpr’ does not name a type i got same error. does anyone fix that?

alejandro-amo commented 5 years ago

Same here. Researching possible solutions

alejandro-amo commented 5 years ago

found it. #25 and #26 are caused for more or less the same thing. see https://github.com/RangeNetworks/OpenBTS-UMTS/issues/26#issuecomment-461852514

bbaranoff commented 4 years ago

If not working just with gcc-5 g++-5 try to add make CXXFLAGS=-std=c++11