In trying to build boost mirror with gcc 4.7.2, I ran into this error, but oddly enough, I see this documentation.
Has ::std::has_nothrow_default_constructor been moved/changed?
In file included from /home/kfeng/src/mirror-lib/include/mirror/type_traits.hpp:20:0,
from /home/kfeng/src/mirror-lib/include/mirror/mirror_base.hpp:38,
from /home/kfeng/src/mirror-lib/include/mirror/mirror.hpp:16,
from /home/kfeng/src/mirror-lib/src/mirror/example/all_member_variables.cpp:10:
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_default_constructible.hpp:31:2: error: ‘has_nothrow_default_constructor’ is not a member of ‘std’
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_default_constructible.hpp:28:9: error: parse error in template argument list
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_default_constructible.hpp:31:43: error: expected ‘{’ before ‘::’ token
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_default_constructible.hpp:31:51: error: expected initializer before ‘||’ token
In file included from /home/kfeng/src/mirror-lib/include/mirror/type_traits.hpp:21:0,
from /home/kfeng/src/mirror-lib/include/mirror/mirror_base.hpp:38,
from /home/kfeng/src/mirror-lib/include/mirror/mirror.hpp:16,
from /home/kfeng/src/mirror-lib/src/mirror/example/all_member_variables.cpp:10:
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_copy_constructible.hpp:31:2: error: ‘has_nothrow_copy_constructor’ is not a member of ‘std’
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_copy_constructible.hpp:28:9: error: parse error in template argument list
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_copy_constructible.hpp:31:40: error: expected ‘{’ before ‘::’ token
/home/kfeng/src/mirror-lib/include/mirror/type_traits/is_copy_constructible.hpp:31:48: error: expected initializer before ‘||’ token
make[2]: *** [src/mirror/example/CMakeFiles/mirror-all_member_variables.dir/all_member_variables.cpp.o] Error 1
make[1]: *** [src/mirror/example/CMakeFiles/mirror-all_member_variables.dir/all] Error 2
make: *** [all] Error 2
ANSWER using Pubby's Note Below
Something like this should work with gcc 4.7.2 - I will submit a patch and let the maintainer decide how best to deal with it.
template <typename T>
struct is_default_constructible
: std::integral_constant<
bool,
::std::has_trivial_default_constructor<T>::value ||
#if __cplusplus>=201103L
::std::is_nothrow_default_constructible<T>::value ||
#else
::std::has_nothrow_default_constructor<T>::value ||
#endif
mirror::_class::_<T>::has_default_ctr::value>
{ };
In C++11 it was changed to std::is_nothrow_default_constructible to be more consistent with naming.
You are looking at documentation for GCC 4.6.2, but using GCC 4.7.2, so it's not very surprising they don't match.
The traits were renamed by n3142
See a previous answer of mine https://stackoverflow.com/a/12716778/981959 for some code that attempts to detect which is supported by your compiler, although a comment says it doesn't work with libc++.
Related
i'm trying to use microsoft SEAL library for homomorphic encryption and following the steps from the below link https://github.com/cyberweapons/SEAL/blob/master/INSTALL.txt
when i use command cmake .
terminal shows below result
-- SEAL detected (version 2.3.1)
-- SEAL build type: Release
-- SEAL debug mode: OFF
-- SEAL using Microsoft GSL: OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ravindra/Desktop/../../MiSEAL/SEAL/SEALExamples
after that when i give make command it should generate a file main.cpp.o instead it is giving the following errors.
[ 50%] Building CXX object CMakeFiles/sealexamples.dir/main.cpp.o
In file included from /usr/local/include/seal/util/mempool.h:12:0,
from /usr/local/include/seal/memorypoolhandle.h:6,
from /usr/local/include/seal/biguint.h:6,
from /usr/local/include/seal/bigpoly.h:9,
from /usr/local/include/seal/seal.h:3,
from /home/ravindra/Desktop/SakhaProjects/S20_AI/MiSEAL/SEAL/SEALExamples/main.cpp:12:
/usr/local/include/seal/util/locks.h:12:45: error: ‘shared_mutex’ is not a member of ‘std’
using ReaderLock = std::shared_lock<std::shared_mutex>;
^~~
/usr/local/include/seal/util/locks.h:12:45: error: ‘shared_mutex’ is not a member of ‘std’
/usr/local/include/seal/util/locks.h:12:62: error: template argument 1 is invalid
using ReaderLock = std::shared_lock<std::shared_mutex>;
^
/usr/local/include/seal/util/locks.h:14:45: error: ‘shared_mutex’ is not a member of ‘std’
using WriterLock = std::unique_lock<std::shared_mutex>;
^~~
/usr/local/include/seal/util/locks.h:14:45: error: ‘shared_mutex’ is not a member of ‘std’
/usr/local/include/seal/util/locks.h:14:62: error: template argument 1 is invalid
using WriterLock = std::unique_lock<std::shared_mutex>;
^
/usr/local/include/seal/util/locks.h:21:20: error: ‘ReaderLock’ does not name a type
inline ReaderLock acquire_read()
^~~~~~~~~~
/usr/local/include/seal/util/locks.h:26:20: error: ‘WriterLock’ does not name a type
inline WriterLock acquire_write()
^~~~~~~~~~
/usr/local/include/seal/util/locks.h:31:20: error: ‘ReaderLock’ does not name a type
inline ReaderLock try_acquire_read()
^~~~~~~~~~
/usr/local/include/seal/util/locks.h:36:20: error: ‘WriterLock’ does not name a type
inline WriterLock try_acquire_write()
^~~~~~~~~~
/usr/local/include/seal/util/locks.h:46:18: error: ‘shared_mutex’ in namespace ‘std’ does not name a type
std::shared_mutex rw_lock_mutex_;
^~~~~~~~~~~~
In file included from /usr/local/include/seal/memorypoolhandle.h:6:0,
from /usr/local/include/seal/biguint.h:6,
from /usr/local/include/seal/bigpoly.h:9,
from /usr/local/include/seal/seal.h:3,
from /home/ravindra/Desktop/SakhaProjects/S20_AI/MiSEAL/SEAL/SEALExamples/main.cpp:12:
/usr/local/include/seal/util/mempool.h: In member function ‘virtual int64_t seal::util::MemoryPoolMT::pool_count() const’:
/usr/local/include/seal/util/mempool.h:561:17: error: ‘ReaderLock’ was not declared in this scope
ReaderLock lock(pools_locker_.acquire_read());
^~~~~~~~~~
CMakeFiles/sealexamples.dir/build.make:62: recipe for target 'CMakeFiles/sealexamples.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/sealexamples.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/sealexamples.dir/all' failed
make[1]: *** [CMakeFiles/sealexamples.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
i am new to SEAL library also i am a beginner to c++ programming, please someone help me to fix this issues.
Hi i found the solution,
i have included following commands in CMakeLists.txt file continued with the steps
`
# Below is TFHE START
export TFHE_PREFIX=/usr/local
export CPLUS_INCLUDE_PATH=${TFHE_PREFIX}/include:${CPLUS_INCLUDE_PATH}
export C_INCLUDE_PATH=${TFHE_PREFIX}/include:${C_INCLUDE_PATH}
export LIBRARY_PATH=${TFHE_PREFIX}/lib:${LIBRARY_PATH}
export LD_LIBRARY_PATH=${TFHE_PREFIX}/lib:${LD_LIBRARY_PATH}
# Below is TFHE END
`
I'm trying to compile the example code for the postgres C++ drivers libpqxx 6 repo here. I keep getting errors (as below). Anyone know how to resolve ?
g++ -std=c++11 -I /usr/local/include/pqxx/ -L /usr/local/lib/ -I
/usr/local/pgsql/include/ -L
/usr/local/pgsql/lib/ postgres.cpp -lpqxx -lpq
In file included from /usr/include/c++/5/functional:55:0,
from /usr/include/c++/5/memory:79,
from /usr/local/include/pqxx/binarystring.hxx:17,
from /usr/local/include/pqxx/binarystring:10,
from /usr/local/include/pqxx/pqxx:10,
from postgres.cpp:2:
/usr/include/c++/5/tuple:991:33: error: ‘array’ was not declared in this scope
struct __is_tuple_like_impl<array<_Tp, _Nm>> : true_type
^
/usr/include/c++/5/tuple:991:44: error: wrong number of template arguments (2, should be 1)
struct __is_tuple_like_impl<array<_Tp, _Nm>> : true_type
^
/usr/include/c++/5/tuple:979:12: note: provided for ‘template<class>
struct std::__is_tuple_like_impl’
struct __is_tuple_like_impl : false_type
^
/usr/include/c++/5/tuple:991:47: error: expected unqualified-id before ‘>’ token
struct __is_tuple_like_impl<array<_Tp, _Nm>> : true_type
^
Makefile:4: recipe for target 'postgres' failed
make: *** [postgres] Error 1
Running ubuntu 12.04, I downloaded the source and compiled it as instructed (see https://github.com/davisking/dlib). Below is the error message displayed.
cmake --build . --config Release
[ 1%] Building CXX object dlib_build/CMakeFiles/dlib.dir/bsp/bsp.cpp.o
In file included from /home/andreif/downlib/dlib-19.2/dlib/bsp/../sockets/../threads/parallel_for_extension.h:9:0,
from /home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads.h:24,
from /home/my_path/dlib-19.2/dlib/bsp/../sockets/sockets_kernel_2.h:33,
from /home/my_path/dlib-19.2/dlib/bsp/../sockets/posix.h:4,
from /home/my_path/dlib-19.2/dlib/bsp/../sockets.h:14,
from /home/my_path/dlib-19.2/dlib/bsp/bsp.h:7,
from /home/my_path/dlib-19.2/dlib/bsp/bsp.cpp:6:
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h: In function ‘std::future<typename std::result_of<_Functor(_ArgTypes="" ...)="">::type> dlib::async(dlib::thread_pool&, Function&&, Args&& ...)’:
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:63:15: error: expected nested-name-specifier before ‘bind_t’
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:63:15: error: ‘bind_t’ has not been declared
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:63:22: error: expected ‘;’ before ‘=’ token
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:63:22: error: expected primary-expression before ‘=’ token
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:63:24: error: expected primary-expression before ‘decltype’
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:63:24: error: expected ‘;’ before ‘decltype’
/home/my_path/dlib-19.2/dlib/bsp/../sockets/../threads/async.h:64:37: error: ‘bind_t’ was not declared in this scope
make[2]: [dlib_build/CMakeFiles/dlib.dir/bsp/bsp.cpp.o] Error 1
make[1]: [dlib_build/CMakeFiles/dlib.dir/all] Error 2
make: *** [all] Error 2
The problem was my c++ compiler: the default gcc 4.6 in ubuntu 12.04 has c++11 support, but it has to be enabled at the command line when calling it. I tried editing /.bashrc to automatically do this, but it didn't work. The solution for me was to install gcc/g++ 4.8 (and use update-alternatives to keep the old installation usable), as described here
http://mortenvp.com/installing-a-newer-gccg-on-ubuntu-12-04-lts/
I am trying to install the gcc-4.8.2 compiler on a remote Debian 7 system, to which I have no root privileges, but only a ssh access. I figured out that the simplest way would be to compile the compiler from source.
I am following this short installation manual from the GCC webpage.
Basically I did the most simple installation, which is summarized at the bottom of the page:
tar xzf gcc-4.8.2.tar.gz
cd gcc-4.8.2
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.8.2/configure --prefix=$HOME/gcc-4.8.2 --enable-languages=c++
make
with the small exception that I did not run the ./contrib/download_prerequisites script on the remote machine because of firewall restrictions. Instead I ran it on my local machine, then compressed the entire folder back into gcc-4.8.2.tar.gz and scp'd it to the remote machine. There I re-created the symbolic links to the prerequisite libraries (gmp,...) and ran make. After several seconds I receive incredible errors:
In file included from ./tm.h:19:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:24:
./options.h:4078:2: error: #error too many masks for ix86_isa_flags
In file included from ../../gcc-4.8.2/gcc/tree.h:26:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:25:
../../gcc-4.8.2/gcc/statistics.h:25:2: error: #error GATHER_STATISTICS must be defined
In file included from ../../gcc-4.8.2/gcc/system.h:268:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:22:
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
../../gcc-4.8.2/gcc/hwint.h:16:39: error: division by zero in #if
In file included from ../../gcc-4.8.2/gcc/tree.h:29:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:25:
../../gcc-4.8.2/gcc/real.h:103:9: error: #error "REAL_WIDTH > 6 not supported"
In file included from ../../gcc-4.8.2/gcc/c-family/c-common.h:24:0,
from ../../gcc-4.8.2/gcc/c/c-tree.h:23,
from ../../gcc-4.8.2/gcc/c/c-lang.c:26:
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:265:3: error: #error "Cannot find a least-32-bit signed integer type"
In file included from ../../gcc-4.8.2/gcc/c/c-lang.c:22:0:
../../gcc-4.8.2/gcc/system.h:500:34: error: declaration of C function ‘const char* strsignal(int)’ conflicts with
In file included from /usr/include/c++/4.7/cstring:44:0,
from ../../gcc-4.8.2/gcc/system.h:205,
from ../../gcc-4.8.2/gcc/c/c-lang.c:22:
/usr/include/string.h:566:14: error: previous declaration ‘char* strsignal(int)’ here
In file included from ../../gcc-4.8.2/gcc/system.h:645:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:22:
../../gcc-4.8.2/gcc/../include/libiberty.h:110:36: error: new declaration ‘char* basename(const char*)’
In file included from /usr/include/c++/4.7/cstring:44:0,
from ../../gcc-4.8.2/gcc/system.h:205,
from ../../gcc-4.8.2/gcc/c/c-lang.c:22:
/usr/include/string.h:603:28: error: ambiguates old declaration ‘const char* basename(const char*)’
In file included from ../../gcc-4.8.2/gcc/tree.h:27:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:25:
../../gcc-4.8.2/gcc/vec.h: In static member function ‘static void va_heap::reserve(vec<T, va_heap, vl_embed>*&, unsigned int, bool)’:
../../gcc-4.8.2/gcc/vec.h:295:7: error: ‘GATHER_STATISTICS’ was not declared in this scope
../../gcc-4.8.2/gcc/vec.h:303:7: error: ‘GATHER_STATISTICS’ was not declared in this scope
../../gcc-4.8.2/gcc/vec.h: In static member function ‘static void va_heap::release(vec<T, va_heap, vl_embed>*&)’:
../../gcc-4.8.2/gcc/vec.h:317:7: error: ‘GATHER_STATISTICS’ was not declared in this scope
In file included from ../../gcc-4.8.2/gcc/tree.h:29:0,
from ../../gcc-4.8.2/gcc/c/c-lang.c:25:
../../gcc-4.8.2/gcc/real.h: At global scope:
../../gcc-4.8.2/gcc/real.h:51:21: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:51:21: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:76:31: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:76:31: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:76:31: error: ‘SIZEOF_LONG’ was not declared in this scope
../../gcc-4.8.2/gcc/real.h:76:31: error: ‘SIZEOF_LONG’ was not declared in this scope
In file included from ../../gcc-4.8.2/gcc/c-family/c-common.h:24:0,
from ../../gcc-4.8.2/gcc/c/c-tree.h:23,
from ../../gcc-4.8.2/gcc/c/c-lang.c:26:
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:267:35: error: expected initializer before ‘cppchar_t’
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:268:9: error: ‘CPPCHAR_SIGNED_T’ does not name a type
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:777:8: error: ‘cppchar_t’ does not name a type
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:788:8: error: ‘cppchar_t’ does not name a type
../../gcc-4.8.2/gcc/../libcpp/include/cpplib.h:966:8: error: ‘cppchar_t’ does not name a type
make[3]: *** [c/c-lang.o] Error 1
make[3]: Leaving directory `/home/mdrozdik/gccbuild/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/home/mdrozdik/gccbuild'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/mdrozdik/gccbuild'
make: *** [all] Error 2
I am compiling with gcc 4.7.2-5 on Debian.
On the local machine there is Ubuntu 13.10 with gcc 4.7.3 and the build seems fine so far (still running).
Please, what could be the cause of these errors?
EDIT:
I checked the /home/mdrozdik/gccbuild/libcpp/config.log file. It is very longm but in two places there are these errors:
configure:3086: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3097: $? = 4
configure:3086: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3097: $? = 4
But the log continues for several pages nevertheless.
I had a similar problem (gcc 4.8.3) and this solved it: g++ 4.7.1 compilation error : conflicting types for ‘strsignal’
The solution was to unset a bunch of C compiler flags (CPATH, etc.)
https://stackoverflow.com/users/1224886/tsbertalan reported this worked for him (and it's what I used):
unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE
I'm using stripped down as much as possible configuration of Qt but now I need to use the dbus and can't figure out what I need to include to be able to use it? There doesnt seem to be anything obvious to me using the qconfig tool. The errors I get at the moment when making are:
qdbus_symbols.cpp:53: error: expected initializer before ‘*’ token
qdbus_symbols.cpp: In function ‘void qdbus_unloadLibDBus()’:
qdbus_symbols.cpp:57: error: ‘qdbus_libdbus’ was not declared in this scope
qdbus_symbols.cpp: In function ‘bool qdbus_loadLibDBus()’:
qdbus_symbols.cpp:67: error: ‘QLibrary’ was not declared in this scope
qdbus_symbols.cpp:67: error: ‘lib’ was not declared in this scope
qdbus_symbols.cpp:67: error: ‘qdbus_libdbus’ was not declared in this scope
qdbus_symbols.cpp:71: error: expected type-specifier before ‘QLibrary’
qdbus_symbols.cpp:71: error: expected ‘;’ before ‘QLibrary’
qdbus_symbols.cpp:85: error: type ‘<type error>’ argument given to ‘delete’, expected pointer
qdbus_symbols.cpp: In function ‘void* qdbus_resolve_conditionally(const char*)’:
qdbus_symbols.cpp:93: error: ‘qdbus_libdbus’ was not declared in this scope
qdbus_symbols.cpp: In function ‘void* qdbus_resolve_me(const char*)’:
qdbus_symbols.cpp:103: error: ‘qdbus_libdbus’ was not declared in this scope
make[1]: *** [.obj/release-static-emb-x86/qdbus_symbols.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/home/mark/qt-qvfb-4.5.3-static/src/dbus'
make: *** [sub-dbus-make_default-ordered] Error 2
Does anyone know a module that I must not be including which is necessary or how to find out? thanks
QT += dbus
should be enough to include the dbus option in the .pro project file, ins't it?
I need more info to give apropriate answer.