On Tuesday 29 March 2011 07:11:57 yangyong203 wrote:
> My error messages as follow:
> -------------------------------------------------------------------
> /usr/bin/g++ -c -D_POSIX_C_SOURCE=199506L -D_POSIX_THREADS
> -D_XOPEN_SOURCE=500 -D_X86_ -DUNIX -D_BSD_SOURCE -Dlinux
> -D_REENTRANT -O3 -Wall -m32 -g -fPIC -I. -I../O.Common -I.
> -I.. -I../../../include/os/Linux -I../../../include
> -I/epics0320/base/include/os/Linux -I/epics0320/base/include
> ../dbSubExample.cpp
> In file included from ../dbSubExample.cpp:6:
> /epics0320/base/include/aSubRecord.h:163: error: expected unqualified-id
> before ‘!’ token
> ---------------------------------------------------------
Ah, this is a very specific problem with the aSub record, which contains a
field named 'NOT', which becomes a structure data member 'not'. The word
'not' is a reserved word in C++ (which the compiler has replaced with the
synonym '!' in the above error message) but not in C, thus the dbSubExample.c
file compiles but it doesn't if you rename it and try to use the C++ compiler.
There is a very simple fix though: Insert the following macro definition into
your dbSubExample.cpp file before the #include <aSubRecord.h> line:
#define not no_t
This will change the name that the C++ compiler sees for that data member into
something that it accepts, and the result should then compile properly.
- Andrew
--
An error is only a mistake if you don't learn from it.
When you learn something from it, it becomes a lesson.
- Replies:
- Re: how to build c++ Dirk Zimoch
- Navigate by Date:
- Prev:
RE: Any upcoming EPICS training Dalesio, Leo
- Next:
Re: how to build c++ Dirk Zimoch
- 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: how to build c++ Andrew Johnson
- Next:
Re: how to build c++ Dirk Zimoch
- 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
|