error: ‘deprecated’ was not declared in this scope - c++11

I updated my program to --std=c++11 and now I get:
g++ --std=c++11 -c eqc.cpp
In file included from eqc.cpp:16:0:
eqc.h:372:80: error: ‘deprecated’ was not declared in this scope
eqc.h:372:92: error: expected ‘)’ before ‘;’ token
eqc.h:372:92: error: expected ‘)’ before ‘;’ token
In file included from eqc.cpp:16:0:
eqc.h:372:74: error: expected unqualified-id before ‘)’ token
equation &operator[](const std::string &label) __attribute__((deprecated));
If I use the new way of specifying attributes, it's the same:
In file included from eqc.cpp:16:0:
eqc.h:371:67: error: ‘deprecated’ was not declared in this scope
eqc.h:371:79: error: expected ‘]’ before ‘;’ token
In file included from eqc.cpp:16:0:
eqc.h:371:61: error: expected unqualified-id before ‘]’ token
equation &operator[](const std::string &label) [[deprecated]];
Since I can't find anything on the web about this error, I must be making some silly mistake. But which?
The system is Ubuntu 16.04 and the compiler:
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

The problem was a library (libginac6 1.7.0) that said
#define deprecated attribute ((deprecated));
After updating the library (to version >= 1.7.1) the error disappeared since the library now says
#define attribute_deprecated attribute ((deprecated));

Related

why does it compile error when i only #include<math.h>

i upgrade gcc to 5.4, it seems to be ok except math.h
when i write a hello.cpp like the following:
#include<math.h>
int main(){return 0;}
then i compile the above cpp with gcc 5.4, g++ 5.4
g++ hello.cpp
errors happen
In file included from /usr/include/math.h:70:0,
from main.cpp:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:63:16: error: expected constructor, destructor, or type conversion before ‘(’ token
__MATHCALL_VEC (cos,, (_Mdouble_ __x));
^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:65:16: error: expected constructor, destructor, or type conversion before ‘(’ token
__MATHCALL_VEC (sin,, (_Mdouble_ __x));
^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:81:22: error: ‘sincos’ has not been declared
__MATHDECL_VEC (void,sincos,,
^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:81:29: error: expected identifier before ‘,’ token
__MATHDECL_VEC (void,sincos,,
^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:82:3: error: expected identifier before ‘(’ token
when i downgrade to gcc 4.8, 4.9, this problem still happens
This question is not reproducuble for me.
g++ hello.cpp -ansi -Wall -pedantic
Compiles without error. And runs:
Valgrind reports no errors upon running.
==100412== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Something is wrong with the poster's installation. Also, as others have said, upgrade gcc.
I found a solution:
apt-get install linux-libc-dev

CppuTest to build with C++11 versions

Installed g++ 4.9.0 (experimental) version under Ubuntu (I am using certain features provided by this version)
When building my code, I use cmake from a script, and it builds correctly. gcc below contains the path where g++ is installed (/mnt...)
$_cmake_ $_dir_ -DCMAKE_CXX_COMPILER=${_gpp_} -DCMAKE_C_COMPILER=${_gcc_} -DCMAKE_BUILD_TYPE=${_build_} -DCMAKE_INSTALL_PREFIX=${_install_} -DBUILD_TESTING:BOOL=1
Now, when I make the CppuTest to build the Unit Tests for my code, I get the following error.
make all
compiling UncrosserTest.cpp
In file included from /home/miguel/Desktop/Ugur/scmProject/scm/dist/dev/mfx_prod/scm/20160207/include/scm/services/primitives.hpp:4:0,
from /home/miguel/Desktop/Ugur/scmProject/log/lidya/src/cpp/scm/services/examples/dummy_strategy/Inside.hpp:6,
from AllTests/Uncrosser/UncrosserTest.cpp:7:
/usr/include/c++/4.9/experimental/optional: In member function ‘void std::experimental::_Optional_base<_Tp, _ShouldProvideDestructor>::_M_construct(_Args&& ...)’:
/usr/include/c++/4.9/experimental/optional:294:18: error: expected type-specifier
::new (std::__addressof(this->_M_payload))
^
/usr/include/c++/4.9/experimental/optional:294:18: error: expected ‘)’
/usr/include/c++/4.9/experimental/optional: In member function ‘void std::experimental::_Optional_base<_Tp, false>::_M_construct(_Args&& ...)’:
/usr/include/c++/4.9/experimental/optional:424:18: error: expected type-specifier
::new (std::__addressof(this->_M_payload))
^
/usr/include/c++/4.9/experimental/optional:424:18: error: expected ‘)’
make: *** [objs/AllTests/Uncrosser/UncrosserTest.o] Error 1
In the CppuTest makefile have included CPPUTEST_CPPFLAGS += -std=c++1y. I guess that am missing some flags in this makefile because as I said the C++ experimental library is building correctly in my "regular" code. What am I missing ?
Possible it's an include problem, see CppUTest Manual - section Conflicts with operator new macros (STL!) and Conflicts with my own overload!
TL;DR
In UncrosserTest add includes for CppUTest after your's.
Instead of
#include <CppUTest/TestHarnes.h>
#include "whatever.h"
do
#include "whatever.h"
#include <CppUTest/TestHarnes.h>

Trying to compile with Codelite on OSX(Mountain Lion) gives missing headers

I am trying out some cross platform GUI environments and have am evaluating wxWidgets using codelite, but have gotten stuck at the very beginning.
I am very new at this, if its a stupid question please say so.
prerequisites are,
Using OSX Mountain Lion
Installed wxmac via home brew
Downloaded Codelite, created a wxWidgets Executable
I make a GUI project and try to install but get a bunch of missing header errors.
make[1]: wx-config: Command not found
g++ -c "xxxx/helloworld/main.cpp" -g -O0 -Wall -o ./Debug/main.o -I. -I.
g++ -c "xxxx/helloworld/MainFrame.cpp" -g -O0 -Wall -o ./Debug/MainFrame.o -I. -I.
In file included from xxxx/helloworld/MainFrame.h:3,
from xxxx/helloworld/MainFrame.cpp:1:
xxxx/helloworld/wxcrafter.h:4:25: error: wx/settings.h: No such file or directory
xxxx/helloworld/wxcrafter.h:5:27: xxxx/helloworld/main.cpp:1:20: error: wx/app.h: No such file or directory
xxxx/helloworld/main.cpp:2:22: error: wx/event.h: No such file or directory
In file included from xxxx/helloworld/MainFrame.h:3,
from xxxx/helloworld/main.cpp:3:
xxxx/helloworld/wxcrafter.h:4:25: error: wx/settings.h: No such file or directory
xxxx/helloworld/wxcrafter.h:5:27: error: wx/xrc/xmlres.h: No such file or directory
xxxx/helloworld/wxcrafter.h:6:27: error: wx/xrc/xh_bmp.h: No such file or directory
xxxx/helloworld/wxcrafter.h:7:22: error: wx/frame.h: No such file or directory
xxxx/helloworld/wxcrafter.h:8:22: error: wx/sizer.h: No such file or directory
xxxx/helloworld/wxcrafter.h:9:22: error: wx/panel.h: No such file or directory
xxxx/helloworld/wxcrafter.h:10:21: error: wx/menu.h: No such file or directory
xxxx/helloworld/wxcrafter.h:11:24: error: wx/toolbar.h: No such file or directory
xxxx/helloworld/main.cpp:4:22: error: wx/image.h: No such file or directory
In file included from xxxx/helloworld/MainFrame.h:3,
from xxxx/helloworld/main.cpp:3:
xxxx/helloworld/wxcrafter.h:14: error: expected class-name before '{' token
xxxx/helloworld/wxcrafter.h:16: error: ISO C++ forbids declaration of 'wxPanel' with no type
xxxx/helloworld/wxcrafter.h:16: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:17: error: ISO C++ forbids declaration of 'wxMenuBar' with no type
xxxx/helloworld/wxcrafter.h:17: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:18: error: ISO C++ forbids declaration of 'wxMenu' with no type
xxxx/helloworld/wxcrafter.h:18: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:19: error: ISO C++ forbids declaration of 'wxMenuItem' with no type
xxxx/helloworld/wxcrafter.h:19: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:20: error: ISO C++ forbids declaration of 'wxMenu' with no type
xxxx/helloworld/wxcrafter.h:20: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:21: error: ISO C++ forbids declaration of 'wxMenuItem' with no type
xxxx/helloworld/wxcrafter.h:21: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:22: error: ISO C++ forbids declaration of 'wxToolBar' with no type
xxxx/helloworld/wxcrafter.h:22: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:25: error: 'wxCommandEvent' has not been declared
xxxx/helloworld/wxcrafter.h:26: error: 'wxCommandEvent' has not been declared
xxxx/helloworld/wxcrafter.h:29: error: expected `)' before '*' token
xxxx/helloworld/wxcrafter.h: In member function 'virtual void MainFrameBaseClass::OnExit(int&)':
xxxx/helloworld/wxcrafter.h:25: error: request for member 'Skip' in 'event', which is of non-class type 'int'
xxxx/helloworld/wxcrafter.h: In member function 'virtual void MainFrameBaseClass::OnAbout(int&)':
xxxx/helloworld/wxcrafter.h:26: error: request for member 'Skip' in 'event', which is of non-class type 'int'
my guess would be to specify the folder that includes all of these, but am not sure where to find them.
Well to be honest I'm not sure if thats the right action at all, maybe I need to install or set something up, perhaps I shouldn't use homebrew and install by source
Added
Thanks to VZ. I got it working, had to change some of the build settings, as bellow
Settings>BuildSettings>gnu g++>Tools>PATH Environment Variables set to
/usr/local/bin:/usr/bin:/bin
Set all the Compiler, Linker, Shared Object Linker settings to absolute path, so change
g++
to
/usr/bin/g++
and so forth.
This surely changes per setup of the machine so it probably shouldn't be followed to the letter, but should get you started.
hope this helps.
The error you need to fix is the very first one:
make[1]: wx-config: Command not found
Make sure wx-config is in your path. Do not specify the include paths manually, this is not the right way to do it, you must use wx-config.
You probably would need to download wxWidgets source code distribution (2.9.4 from this page or latest source code from SVN), unpack it, build libs from the source code
./configure && make && sudo make install
then reboot and after that try to build the Codellite.

Install ree-1.8.7 with RVM on Mountain Lion [duplicate]

This question already has answers here:
Mountain Lion rvm install 1.8.7 x11 error
(5 answers)
Closed 8 years ago.
I had a fresh install of Mountain Lion and installed the Xcode Command Line Tools, . I was able to get homebrew running and installed RVM. Unfortunately, I can't get RVM to install ree-1.8.7-head. It fails when compiling. I thought it was related to X11, so I installed XQuartz. Still no joy. Then I went ahead and installed the full Xcode from the app store. Still no joy. Anyone gotten this going on a fresh Mountain Lion install?
From the bottom of the .rvm/log/ree-1.8.7-head/make.log:
Find Tcl/Tk libraries. Make tcltklib.so which is required by Ruby/Tk.
gcc -I. -I../.. -I../../. -I../.././ext/tk -DHAVE_RB_SAFE_LEVEL -DHAVE_RB_HASH_LOOKUP -DHAVE_RB_PROC_NEW -DHAVE_RB_OBJ_TAINT -DHAVE_ST_PTR -DHAVE_ST_LEN -DRUBY_VERSION=\"1.8.7\" -DRUBY_RELEASE_DATE=\"2012-02-08\" -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -DWITH_TCL_ENABLE_THREAD=0 -fno-common -g -O2 -pipe -fno-common -c stubs.c
In file included from stubs.c:10:
/usr/include/tk.h:78:23: error: X11/Xlib.h: No such file or directory
In file included from stubs.c:10:
/usr/include/tk.h:549: error: expected declaration specifiers or ‘...’ before ‘Window’
/usr/include/tk.h:549: error: ‘Window’ declared as function returning a function
.
.
/usr/include/tkDecls.h:1240: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute
__’ before ‘Tk_GetBitmapFromObj’
/usr/include/tkDecls.h:1245: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/tkDecls.h:1356: error: expected ‘)’ before ‘*’ token
/usr/include/tkDecls.h:1362: error: expected ‘)’ before ‘*’ token
/usr/include/tkDecls.h:1387: error: expected declaration specifiers or ‘...’ before ‘GC’
/usr/include/tkDecls.h:1399: error: expected declaration specifiers or ‘...’ before ‘GC’
/usr/include/tkDecls.h:1413: error: expected declaration specifiers or ‘...’ before ‘Pixmap’
/usr/include/tkDecls.h:1420: error: expected declaration specifiers or ‘...’ before ‘XColor’
/usr/include/tkDecls.h:1448: error: expected declaration specifiers or ‘...’ before ‘Pixmap’
/usr/include/tkDecls.h:1524: error: expected ‘)’ before ‘*’ token
/usr/include/tkDecls.h:1621: error: expected declaration specifiers or ‘...’ before ‘Drawable’
/usr/include/tkDecls.h:1656: error: expected ‘)’ before ‘*’ token
/usr/include/tkDecls.h:1661: error: expected ‘)’ before ‘*’ token
/usr/include/tkDecls.h:1692: error: expected specifier-qualifier-list before ‘XColor’
make[1]: *** [stubs.o] Error 1
make: *** [all] Error 1
try
rvm reinstall 1.8.7 --without-tcl --without-tk
but still your problem might to be related to gcc-4.2 -> it's required for MRI ruby, there are some successes with llvm/clang, but still it fails with Fibers
If you don't need tcl or tk and are using rbenv, this should work:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
CC=/usr/local/bin/gcc-4.2 CONFIGURE_OPTS="--without-tcl --without-tk" rbenv install 1.8.7-p358

Error compiling imapfilter 2.4.1 in CentOS 5.6

I am trying to compile imapfilter 2.4.1 ( https://github.com/lefcha/imapfilter ) in CentOS 5.6. I believe I've got all the dependencies sorted but when I run make I get:
make[1]: Entering directory `/home/src/imapfilter-2.4.1/src'
cc -Wall -O -DMAKEFILE_SHAREDIR='"/usr/local/share/imapfilter"' -c -o core.o core.c
core.c:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ifcorelib’
core.c: In function ‘ifcore_append’:
core.c:947: warning: implicit declaration of function ‘lua_strlen’
core.c: In function ‘luaopen_ifcore’:
core.c:1162: warning: implicit declaration of function ‘luaL_register’
core.c:1162: error: ‘ifcorelib’ undeclared (first use in this function)
core.c:1162: error: (Each undeclared identifier is reported only once
core.c:1162: error: for each function it appears in.)
make[1]: *** [core.o] Error 1
make[1]: Leaving directory `/home/src/imapfilter-2.4.1/src'
make: *** [all] Error 2
Based on other user comments and file revision dates I am sure this should compile. I am guessing I'm missing a library somewhere. I'll appreciate any help I can get on this.
Starting from first error message:
core.c:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ifcorelib’
Line 41 of core.c is:
static const luaL_reg ifcorelib[] = {
Cryptic message from gcc means that it knows nothing about what is the luaL_reg and it thinks that it is variable name. Then it goes into panic when reads second variable name in the same definition/declaration. luaL_reg should be something like struct.
So, it seems that your problems are located in LUA development headers. May be you have too old or even to modern Lua package.
The imapfilter's github's readme says:
Compile time requirements are Lua (version 5.1)
Are you sure that your lua is 5.1 and the lua-devel (or any other package with lua headers) is 5.1 too?

Resources