On 6/13/23 10:47, Mark Rivers via Tech-talk wrote:
...
If I use the c++11 flag then I get this error:
|make[1]: Entering directory `/home/epics/devel/areaDetector-3-12-1/ADPICam/PICamApp/src/O.linux-x86_64'|
|/usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_X86_64_ -DUNIX -Dlinux -O3 -g -Wall -std=c++11 -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/bits/hashtable.h:35:0,|
| from /usr/include/c++/4.8.2/unordered_map:47,|
...
|/usr/include/c++/4.8.2/bits/hashtable_policy.h:1070:12: error: invalid use of incomplete type 'struct std::hash<PicamParameter>'|
As Matt mentioned, this is apparently a known issue with c++11
that std::hash<> didn't work out of the box for enum types
until c++14, which GCC 4.8 does not support (it didn't even
have complete support for c++11).
https://cplusplus.github.io/LWG/issue2148
https://en.cppreference.com/w/cpp/utility/hash
As a workaround you could either:
1) Use std::map when compiling with <= c++14
#if __cplusplus>=201402L
typedef std::unordered_map<PicamParameter, int> pcparam_map_t;
#else
typedef std::map<PicamParameter, int> pcparam_map_t;
#endif
2) provide your own specialization of std::hash
#if __cplusplus<201402L
namespace std {
template<>
struct hash<PicamParameter> {
size_t operator()(PicamParameter v) {
return std::hash((int)PicamParameter);
}
};
}
#endif
3) Or switch the ordered_map to an 'int' key, and case the enum to 'int' everywhere
(probably the uglier of the three)
- References:
- C++ std problem Mark Rivers via Tech-talk
- Navigate by Date:
- Prev:
Re: cross-compiling v7.0.7 Mark Rivers via Tech-talk
- Next:
Re: cross-compiling v7.0.7 Andrew Johnson via Tech-talk
- 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
- Navigate by Thread:
- Prev:
Re: C++ std problem Wlodek, Jakub via Tech-talk
- Next:
Trying to install EPICS on CentOS 7 Brandon Gunn via Tech-talk
- 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
|