1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 <2023> 2024 2025 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 <2023> 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: C++ std problem |
From: | "Pearson, Matthew via Tech-talk" <tech-talk at aps.anl.gov> |
To: | Mark Rivers <rivers at cars.uchicago.edu>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov> |
Date: | Wed, 14 Jun 2023 14:00:48 +0000 |
Thanks Mark. It’s probably best to not attempt to use c++1y anyway, since the gcc man page says “Support is highly experimental”.
Cheers, Matt From: Mark Rivers <rivers at cars.uchicago.edu>
Hi Matt,
·
Using enum for the hash was fixed
in C++14, so for gcc 4.8.5 can you try this and see if it works?
·
USR_CXXFLAGS_Linux += -std=c++1y Thanks for the suggestion. I tried using -std=c++1y, but the results are the same as -std=c++11. It looks like ADPICam requires a newer version of gcc than 4.8.5. CentOS
8 with gcc 8.5.0 works fine. Mark From: Pearson, Matthew <pearsonmr at ornl.gov> Hi Mark, Using std::hash with enum types (and
PicamParameter is an enum) might be the issue: https://stackoverflow.com/questions/18837857/cant-use-enum-class-as-unordered-map-key The Galil driver declares a map like: std::unordered_map<std::string, Source> map And std::string was already supported as a hash type in C++11. Using enum for the hash
was fixed in C++14, so for gcc 4.8.5 can you try this and see if it works? USR_CXXFLAGS_Linux += -std=c++1y C++14 is the default for gcc 8.5.0, which might explain why it works on Centos 8. Cheers, Matt From: Tech-talk <tech-talk-bounces at aps.anl.gov>
On Behalf Of Mark Rivers via Tech-talk I should add that ADPICam.cpp compiles fine on Centos 8 Stream (gcc 8.5.0).
I have compiled other files that use std::unordered_map on gcc 4.8.5 without problems, for example the EPICS Galil motor controller. Thanks, Mark From: Tech-talk <tech-talk-bounces at aps.anl.gov>
On Behalf Of Mark Rivers via Tech-talk I am trying to build areaDetector/ADPICam on Centos 7 (gcc 4.8.5). It uses std::unordered_map which I believe was added in C++11. If I compile without this line in the Makefile USR_CXXFLAGS_Linux += -std=c++11 then I get this error, which is expected because it is not using C++11. /usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -g -Wall -mtune=generic
-m64 -fPIC -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I/corvette/home/epics/devel/asyn-4-43/include -I/corvette/home/epics/devel/areaDetector-3-12-1/ADSupport/include/os/Linux -I/corvette/home/epics/devel/areaDetector-3-12-1/ADSupport/include
-I/corvette/home/epics/devel/areaDetector-3-12-1/ADCore/include -I/corvette/usr/local/epics-devel/base-7.0.7/include/compiler/gcc -I/corvette/usr/local/epics-devel/base-7.0.7/include/os/Linux -I/corvette/usr/local/epics-devel/base-7.0.7/include -c ../ADPICam.cpp In file included from /usr/include/c++/4.8.2/unordered_map:35:0, from ../ADPICam.h:16, from ../ADPICam.cpp:19: /usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for
the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options. #error This file requires compiler and library support for the \ ^ In file included from ../ADPICam.cpp:19:0: ../ADPICam.h:546:33: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled
by default] bool imageThreadKeepAlive = true; ^ ../ADPICam.h:553:5: error: 'unordered_map' in namespace 'std' does not name a type std::unordered_map<PicamParameter, int> parameterExistsMap; If I use the c++11 flag then I get this error:
Can anyone explain what that error means, and is it possible to use gcc 4.8.5 to compile this file? Mark |