Compiling my program I have this error:
/usr/include/xercesc/util/Compilers/GCCDefs.hpp:133:60: error: declaration of ‘int strcasecmp(const char*, const char*)’ has a different exception specifier
/usr/include/string.h:536:12: error: from previous declaration ‘int strcasecmp(const char*, const char*) throw ()’
make: *** [src/test/VFTImageMaterial.o] Error 1
Any idea about this conflict with string.h?
You need to define HAVE_STRCASECMP. This probably should be defined automatically by ./configure in config.h - have you run ./configure?
Related
I am trying to build gcc-12.2.0 using documentation given in lfs (linux from scratch) https://www.linuxfromscratch.org/blfs/view/svn/general/gcc.html. I am coming across the error: ‘nullptr’ was not declared in this scope. I am running gcc-7.5.0 on ubuntu-18.04.
A bit of background to the error is that there first a warning
../../../gcc-12.2.0/libcpp/include/cpplib.h:1141:1: warning: scoped enums only available with -std=c++11 or -std=gnu++11
enum class CPP_time_kind.
Then the errror (4 times)
../../../gcc-12.2.0/libcpp/files.cc: In function ‘bool _cpp_stack_file(cpp_reader*, _cpp_file*, include_type, location_t)’:
../../../gcc-12.2.0/libcpp/files.cc:910:15: error: ‘nullptr’ was not declared in this scope
char *buf = nullptr;
../../../gcc-12.2.0/libcpp/files.cc: In function ‘_cpp_file* test_header_unit(cpp_reader*, const char*, bool, location_t)’:
../../../gcc-12.2.0/libcpp/files.cc:1125:10: error: ‘nullptr’ was not declared in this scope
return nullptr;
../../../gcc-12.2.0/libcpp/files.cc: In function ‘const char* _cpp_find_header_unit(cpp_reader*, const char*, bool, location_t)’:
../../../gcc-12.2.0/libcpp/files.cc:1150:10: error: ‘nullptr’ was not declared in this scope
return nullptr;
../../../gcc-12.2.0/libcpp/files.cc: In function ‘const char* cpp_probe_header_unit(cpp_reader*, const char*, bool, location_t)’:
../../../gcc-12.2.0/libcpp/files.cc:1163:10: error: ‘nullptr’ was not declared in this scope
return nullptr;
All the posts I have googled relate to this error appearing in the running of a specific program using c++ or g++, not in compiling gcc.
I have no idea how to include -std=c++11 in my gcc build.
Assistance in solving this problem will be appreciated.
I am trying to compile my own code using some functions in this library: tsnnls
This libraries also uses other libraries: Lapack, Blas, Argtable2, TAUCS
It seems that there are some incompatiablity in error handling of function between math.h and taucs.h. Please help me in sorting out these error.
Here are error messages:
$ sudo make
g++ -c tsnnls_test_DKU.c
In file included from /usr/include/math.h:69:0,
from tsnnls_test_DKU.c:96:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:201:74: error: declaration of ‘int isinf(double) throw ()’ has a different exception specifier
__MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
^
In file included from tsnnls.h:31:0,
from tsnnls_test_DKU.c:57:
taucs_basic/taucs.h:814:12: error: from previous declaration ‘int isinf(double)’
extern int isinf(double);
^
In file included from /usr/include/math.h:69:0,
from tsnnls_test_DKU.c:96:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:204:75: error: declaration of ‘int finite(double) throw ()’ has a different exception specifier
__MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
^
In file included from tsnnls.h:31:0,
from tsnnls_test_DKU.c:57:
taucs_basic/taucs.h:811:12: error: from previous declaration ‘int finite(double)’
extern int finite(double);
^
In file included from /usr/include/math.h:69:0,
from tsnnls_test_DKU.c:96:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:234:74: error: declaration of ‘int isnan(double) throw ()’ has a different exception specifier
__MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
^
In file included from tsnnls.h:31:0,
from tsnnls_test_DKU.c:57:
taucs_basic/taucs.h:808:12: error: from previous declaration ‘int isnan(double)’
extern int isnan(double);
^
tsnnls_test_DKU.c: In function ‘int main(int, char**)’:
tsnnls_test_DKU.c:442:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
colvector_write_mat(outfile,xvals,Acols,"x");
^
make: *** [tsnnls_test_DKU.o] Error 1
I am trying to compile the newest version of the Armadillo Linear Algebra library (4.300.8) and am running into the following errors when running make after cmake . runs successfully.
Scanning dependencies of target armadillo
[100%] Building CXX object CMakeFiles/armadillo.dir/src/wrapper.cpp.o
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp: In function ‘hid_t arma::arma_H5Dopen(hid_t, const char*, hid_t)’:
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:890:43: error: too many arguments to function ‘hid_t H5Dopen1(hid_t, const char*)’
/usr/include/H5Dpublic.h:145:14: note: declared here
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp: In function ‘hid_t arma::arma_H5Dcreate(hid_t, const char*, hid_t, hid_t, hid_t, hid_t, hid_t)’:
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:900:83: error: too many arguments to function ‘hid_t H5Dcreate1(hid_t, const char*, hid_t, hid_t, hid_t)’
/usr/include/H5Dpublic.h:143:14: note: declared here
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp: In function ‘herr_t arma::arma_H5Eset_auto(hid_t, H5E_auto1_t, void*)’:
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:950:54: error: invalid conversion from ‘hid_t {aka int}’ to ‘H5E_auto1_t {aka int (*)(void*)}’ [-fpermissive]
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:950:54: error: invalid conversion from ‘H5E_auto1_t {aka int (*)(void*)}’ to ‘void*’ [-fpermissive]
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:950:54: error: too many arguments to function ‘herr_t H5Eset_auto1(H5E_auto1_t, void*)’
/usr/include/H5Epublic.h:216:15: note: declared here
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp: In function ‘herr_t arma::arma_H5Eget_auto(hid_t, herr_t (**)(void*), void**)’:
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:955:54: error: invalid conversion from ‘hid_t {aka int}’ to ‘herr_t (**)(void*) {aka int (**)(void*)}’ [-fpermissive]
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:955:54: error: invalid conversion from ‘herr_t (**)(void*) {aka int (**)(void*)}’ to ‘void**’ [-fpermissive]
/home/user/Desktop/armadillo-4.300.8/src/wrapper.cpp:955:54: error: too many arguments to function ‘herr_t H5Eget_auto1(herr_t (**)(void*), void**)’
/usr/include/H5Epublic.h:212:15: note: declared here
make[2]: *** [CMakeFiles/armadillo.dir/src/wrapper.cpp.o] Error 1
make[1]: *** [CMakeFiles/armadillo.dir/all] Error 2
make: *** [all] Error 2
I am using gcc version 4.7.3 and running Ubuntu 12.04.
Thanks!
It looks like the HDF5 library is causing problems. Uninstall the HDF5 library, and then reinstall Armadillo.
Another option is to update your system to Ubuntu 14.04. The previous Ubuntu LTS release (12.04) is ancient by open-source standards.
I have successfully generated the .py and .cpp files needed using:
swig -c++ -python sf_c_api.i
but now I'm trying to make the shared object (.so) and I'm getting swamped with errors.
g++ -Wall -g -fPIC -I/usr/include/python2.6 -c atob.c fish.c maby_swap.c pwd_file.c pwd.c setup_fish.c shs.c sf_c_api.cpp sha1.cpp sf_c_api_wrap.cpp
Can anyone make heads or tails of this g++ output?
In file included from /usr/include/python2.6/Python.h:8,
from sf_c_api_wrap.cpp:149:
/usr/include/python2.6/pyconfig.h:1038:1: warning: "_XOPEN_SOURCE" redefined
<built-in>: warning: this is the location of the previous definition
In file included from /usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/postypes.h:42,
from /usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h:42,
from /usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/string:42,
from /usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/stdexcept:39,
from sf_c_api_wrap.cpp:3024:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:143: error: ‘::btowc’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:148: error: ‘::fwide’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:149: error: ‘::fwprintf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:150: error: ‘::fwscanf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:153: error: ‘::mbrlen’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:154: error: ‘::mbrtowc’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:155: error: ‘::mbsinit’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:156: error: ‘::mbsrtowcs’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:159: error: ‘::swprintf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:160: error: ‘::swscanf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:162: error: ‘::vfwprintf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:166: error: ‘::vswprintf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:170: error: ‘::vwprintf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:174: error: ‘::wcrtomb’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:185: error: ‘::wcsrtombs’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:195: error: ‘::wctob’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:196: error: ‘::wmemcmp’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:197: error: ‘::wmemcpy’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:198: error: ‘::wmemmove’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:199: error: ‘::wmemset’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:200: error: ‘::wprintf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:201: error: ‘::wscanf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:205: error: ‘::wcsstr’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:206: error: ‘::wmemchr’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar: In function ‘wchar_t* std::wcsstr(wchar_t*, const wchar_t*)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:223: error: invalid conversion from ‘const wchar_t*’ to ‘wchar_t*’
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:223: error: initializing argument 1 of ‘wchar_t* std::wcsstr(wchar_t*, const wchar_t*)’
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar: In function ‘wchar_t* std::wmemchr(wchar_t*, wchar_t, size_t)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:227: error: invalid conversion from ‘const wchar_t*’ to ‘wchar_t*’
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:227: error: initializing argument 1 of ‘wchar_t* std::wmemchr(wchar_t*, wchar_t, size_t)’
In file included from /usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/string:42,
from /usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/stdexcept:39,
from sf_c_api_wrap.cpp:3024:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h: In static member function ‘static int std::char_traits<wchar_t>::compare(const wchar_t*, const wchar_t*, size_t)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h:330: error: ‘wmemcmp’ was not declared in this scope/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h: In static member function ‘static const wchar_t* std::char_traits<wchar_t>::find(const wchar_t*, size_t, const wchar_t&)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h:338: error: initializing argument 1 of ‘wchar_t* std::wmemchr(wchar_t*, wchar_t, size_t)’
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h: In static member function ‘static wchar_t* std::char_traits<wchar_t>::move(wchar_t*, const wchar_t*, size_t)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h:342: error: ‘wmemmove’ was not declared in this scope
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h: In static member function ‘static wchar_t* std::char_traits<wchar_t>::copy(wchar_t*, const wchar_t*, size_t)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h:346: error: ‘wmemcpy’ was not declared in this scope
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h: In static member function ‘static wchar_t* std::char_traits<wchar_t>::assign(wchar_t*, size_t, wchar_t)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h:350: error: ‘wmemset’ was not declared in this scope
/../include/c++/4.4.4/bits/char_traits.h:338: error: invalid conversion from ‘const wchar_t*’ to ‘wchar_t*’
I found a solution.
The problem is that under solaris:
If -D_XOPEN_SOURCE_EXTENDED=1, g++ cannot compile even an empty body
that #includes <iostream>. If it's undefined, then gcc cannot compile
C code.
[source]
and from /usr/include/python2.6/pyconfig.h:
/* Define to activate Unix95-and-earlier features */
#define _XOPEN_SOURCE_EXTENDED 1
Removing the XOPEN definitions fixed my problem.
I installed tidy-dev from ubuntu repository, checked installation path - it's okay (/usr/include/tidy).
But I can not find a true flags to compile my c++ script with include tidy c++ wrapper tidyx.h from http://users.rcn.com/creitzel/tidy/tidyx.h
Can you help me?
My test script file named 1.cpp, tidyx.h I put near. 1.cpp content:
#include "tidyx.h"
int main()
{
}
I try it, but no-good:
$ gcc -I/usr/include/tidy 1.cpp -ltidy
In file included from 1.cpp:1:
tidyx.h: In constructor ‘Tidy::Source::Source()’:
tidyx.h:83: error: invalid conversion from ‘int (*)(ulong)’ to ‘int (*)(void*)’
tidyx.h:84: error: invalid conversion from ‘void (*)(ulong, byte)’ to ‘void (*)(void*, byte)’
tidyx.h:85: error: invalid conversion from ‘Bool (*)(ulong)’ to ‘Bool (*)(void*)’
tidyx.h:86: error: invalid conversion from ‘ulong’ to ‘void*’
tidyx.h: In constructor ‘Tidy::Sink::Sink()’:
tidyx.h:123: error: invalid conversion from ‘void (*)(ulong, byte)’ to ‘void (*)(void*, byte)’
tidyx.h:124: error: invalid conversion from ‘ulong’ to ‘void*’
tidyx.h: In member function ‘void Tidy::Buffer::Attach(void*, uint)’:
tidyx.h:165: error: invalid conversion from ‘void*’ to ‘byte*’
tidyx.h:165: error: initializing argument 2 of ‘void tidyBufAttach(TidyBuffer*, byte*, uint)’
tidyx.h: In member function ‘int Tidy::Document::Create()’:
tidyx.h:496: error: invalid conversion from ‘ulong’ to ‘void*’
tidyx.h:496: error: initializing argument 2 of ‘void tidySetAppData(const _TidyDoc*, void*)’
tidyx.h: In member function ‘void Tidy::Document::SetAppData(ulong)’:
tidyx.h:511: error: invalid conversion from ‘ulong’ to ‘void*’
tidyx.h:511: error: initializing argument 2 of ‘void tidySetAppData(const _TidyDoc*, void*)’
tidyx.h: In member function ‘ulong Tidy::Document::GetAppData()’:
tidyx.h:512: error: invalid conversion from ‘void*’ to ‘ulong’
To include a header file you need to use the #include preprocessor directive. It will look for the header file in compiler include paths.
If tidyx.h is in /usr/include/tidy you could put in your source file:
#include <tidy/tidyx.h>
and then compile just with gcc script.cpp, since /usr/include is most likely a default include path for your compiler.
Otherwise you could also put in your source file:
#include <tidyx.h>
And then tell GCC to look in /usr/include/tidy: gcc -I/usr/include/tidy script.cpp
At this point the header will be found. If you'll get other errors related to tidy (eg: some tidy functions are not defined) you'll need to link your binary to some library using GCC -l option.
EDIT after OP's massive edit.
Your problem here is that tidyx.h contains C++ code, and also your source file, looking to its extensions, seems to be a C++ source file. You'll need a C++ compiler in order to compile it. Use g++ instead of gcc:
g++ script.cpp