I am trying to compile a program using boost thread with the latest version. I am using
gcc version 4.1.2 20080704 (Red Hat 4.1.2-52)
With the 1.50 I had an issue saying that the reference to boost::thread::~thrad() couldn't be found. So I updated to the new one I got the following
/usr/local/include/boost/thread/detail/thread.hpp:65: error: expected ';' before 'thread_data'
/usr/local/include/boost/thread/detail/thread.hpp:68: error: expected `;' before 'thread_data'
/usr/local/include/boost/thread/detail/thread.hpp:88: error: expected ';' before 'thread_data'
/usr/local/include/boost/thread/detail/thread.hpp:91: error: expected `;' before 'void'
/usr/local/include/boost/thread/detail/thread.hpp:105: error: expected ';' before 'thread_data'
/usr/local/include/boost/thread/detail/thread.hpp:108: error: expected `;' before 'void'
/usr/local/include/boost/thread/detail/thread.hpp:121: error: expected ';' before 'private'
/usr/local/include/boost/thread/detail/thread.hpp:153: error: expected primary-expression before ')' token
/usr/local/include/boost/thread/detail/thread.hpp:153: error: there are no arguments to 'BOOST_THREAD_RV_REF' that depend on a template parameter, so a declaration of 'BOOST_THREAD_RV_REF' must be available
/usr/local/include/boost/thread/detail/thread.hpp:153: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/usr/local/include/boost/thread/detail/thread.hpp:153: error: expected `)' before 'f'
/usr/local/include/boost/thread/detail/thread.hpp:153: error: invalid in-class initialization of static data member of non-integral type 'boost::detail::thread_data_ptr'
/usr/local/include/boost/thread/detail/thread.hpp:153: confused by earlier errors, bailing out
I had no clue why is doing this way. Is there any workaround?
I had this same issue with g++ 4.2.1 on OSX, though I don't think its a compiler issue per se.
I had previously installed boost libraries and headers installed to /usr/local/lib and /usr/local/include by invoking b2 install. This works on a new installation, but it doesn't correctly overwrite a previous boost installation (I had 1.49). All I had to do was point my build at the boost build directory I was using, or to delete /usr/local/include/boost and run b2 install again. The first time I ran b2 install it only copied the libs which was fast, the second time it took much longer and copied over all the header files.
Related
I'm trying to upgrade libcurl from older version to the newest stable on, 7.37.0.
They changed 'curl_base64.h' and because of that the compilation breaks.
I get the following error:
utils/libcurl/include/curl/curl_base64.h:25: error: CURLcode' does not name a type
utils/libcurl/include/curl/curl_base64.h:29: error:CURLcode' does not name a type
../src/Api.cc: In member function ERRCC Api::UpdateFile(go, off, std::string&, bool)':
Api.cc:54: error:SessionHandle' undeclared (first use this function)
Api.cc:54: error: (Each undeclared identifier is reported only once for each function it appears in.)
Api.cc:54: error: expected primary-expression before ')' token
Api.cc:54: error: `Curl_base64_encode' undeclared (first use this function)
I tried to add 'curl.h' as a header to API.cc, it didn't help.
I have 'curl_base64.h' in my headers.
the CURLcode is a enum defind in curl.h
'curl_base64.h' is not an external header file and thus no application should include it - doing so means you are on your own. It is not part of the API. The API is stable and documented, and the only public headers are in the curl/ directory after an installation.
I am trying to use the Accelerate framework on a small C++ program. I'm not even using XCode, only a simple Makefile.
The compiler complains when I add the following line to my code:
#include <Accelerate/Accelerate.h>
The error is the following:
In file included from /System/Library/Frameworks/vecLib.framework/Headers/vecLib.h:41,
from /System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h:20,
from Diana.cpp:20:
/System/Library/Frameworks/vecLib.framework/Headers/vDSP.h:9008: error: expected identifier before numeric constant
/System/Library/Frameworks/vecLib.framework/Headers/vDSP.h:9008: error: expected `}' before numeric constant
/System/Library/Frameworks/vecLib.framework/Headers/vDSP.h:9008: error: expected unqualified-id before numeric constant
/System/Library/Frameworks/vecLib.framework/Headers/vDSP.h:9028: error: expected declaration before ‘}’ token
The compiler I'm using is i686-apple-darwin11-llvm-g++-4.2, which is a gcc 4.2.1, and the line that I use to compile (not to link) is:
i686-apple-darwin11-llvm-g++-4.2 -D__MACOSX_CORE__ -c -o Diana.o Diana.cpp
Should I add some additional flag(s) when compiling this? I tried adding the "-framework Accelerate", but it doesn't change anything, since this should only be included in the linkage process (am I right?).
I googled some of these error messages and I didn't find anything.
I would really appreciate any help. Thank you!
PS: My OS X version is Lion 10.7.5, and XCode is 4.4.1.
I figured it out: I checked what was on line 9008 of vDSP.h and the problem was that I was declaring an FFT_FORWARD constant before including the Accelerate.h.
Fixed!
I am trying to use a function called edfImport (available here: http://kobi.nat.uni-magdeburg.de/edfImport)
In order to use the function, I must first run edfCompile (included in the toolkit). When running edfCompile, I get an error:
??? Error using ==> mex
Unable to complete successfully
I am running MATLAB 7.1 (R14) and have the latest version of MinGW, Cygwin and Gnumex setup for my compiler (according to the instructions on this page: http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII4.0/cygwin.htm)
I am able to compile example mex files, but I'm still not convinced that this isn't an issue with the way my compiler is setup. Any tips gratefully received. It would be nice to know if anyone else has trouble running edfCompile as well... (http://kobi.nat.uni-magdeburg.de/edfImport)
Many thanks
Edit: The error message in full:
In file included from edfMexImport.cpp:6:0:
EDFFile2.h:37:39: error: 'mwSize' has not been declared
EDFFile2.h:127:45: error: 'mwIndex' has not been declared
edfMexImport.cpp: In function 'void mexFunction(int, mxArray**, int, const mxArray**)':
edfMexImport.cpp:12:3: error: 'mwSize' was not declared in this scope
edfMexImport.cpp:12:10: error: expected ';' before 'OutputDims'
edfMexImport.cpp:48:12: error: expected ';' before 'OptionsDimN'
edfMexImport.cpp:49:9: error: 'OptionsDimN' was not declared in this scope
edfMexImport.cpp:51:13: error: 'OptionsDim' was not declared in this scope
edfMexImport.cpp:51:33: error: expected primary-expression before ')' token
edfMexImport.cpp:51:34: error: expected ';' before 'mxGetDimensions'
edfMexImport.cpp:73:12: error: expected ';' before 'FlagsDimN'
edfMexImport.cpp:74:9: error: 'FlagsDimN' was not declared in this scope
edfMexImport.cpp:76:13: error: 'FlagsDim' was not declared in this scope
edfMexImport.cpp:76:31: error: expected primary-expression before ')' token
edfMexImport.cpp:76:32: error: expected ';' before 'mxGetDimensions'
C:\PROGRAM FILES\MATLAB71\BIN\MEX.PL: Error: Compile of 'edfMexImport.cpp' failed.
??? Error using ==> mex
Unable to complete successfully
Error in ==> edfCompile at 15
eval(sprintf('mex -I''%s'' edfMexImport.cpp EDFFILE2.cpp ''%s/edfapi.lib''', edfapiIncludesFolder, edfapiLibraryFolder));
It looks like some type definitions are missing, particularly the mwSize and mwIndex type.
Can you add the following to EDFFile2.h and try again?
just below
#include "edf.h"
#include <mex.h>
add this:
#ifndef mwSize
#define mwSize int
#endif
#ifndef mwIndex
#define mwIndex int
#endif
The MEX file has been modified to support the 64-bit "large array handling API", as described in this document:
http://www.mathworks.com/support/solutions/en/data/1-5C27B9/
Note that this optional large variable support was first added in R7.3 (2006b), and your version is even older. Basically, your MATLAB is too old for the API used by the MEX file. That said, if the MEX file is simple enough, Gunther's solution might be the simple answer to "backport" the MEX file to your older MATLAB. Functions like mxGetDimensions() now return mwSize*, but used to return int*.
So upgrade MATLAB if you can, else try Gunther's answer and let us know how it goes.
Have you looked inside edfCompile.m? Unfortunatlly I don't have Matlab installed on my PC, so I can only suggest you to try to compile the two .cpp files edfMexImport.cpp and EDFFILE2.cpp manually with edfapi.lib
I'm using a Mac. I have a library written in C++, let's call it "wibble", along with its source code. I can compile this source with GCC 4.3 from macports (g++-mp-4.3), and can link the resulting library into other stuff as long as I use GCC 4.3.
However, I need to link this into another application (let's call it "blort") which will only load libs compiled with the GCC 4.2 that is bundled with OS X 10.6 (because that's what it was built with)
I can, more or less, mess with wibble's Makefile however I may please, but blort is a fixed target. I can write whatever code or build scripts to glue them together I may need. There appears to be no way to get wibble to compile on 4.2 (barring a rewrite, which is out of the question), and the guy who wrote it confirms that.
I am not very familiar with the whole build and linking process in C++, having only been handed this integration, and am completely stumped. Is what I'm trying to achieve even possible? If so, how?
In case it matters, what I'm trying to do is call the methods in wibble from Perl via Inline::CPP, but I'm willing to write raw XS if I have to (I've done that before, at least). I need to use the system perl so this will easily build and install on other people's machines. :-/
UPDATE, 2012-03-01, 1
I am looking into compiling protobufs using the Mac's compiler, and seeing if I can get wibble to compile with the same compiler using that build of protobufs. I will post the results shortly.
Hrmph same errors:
g++ -Wall -Wno-unused-function -Wno-long-long -pedantic -O3 -I/Users/sscaffid/local/include -L/Users/sscaffid/local/lib -fPIC -std=c++98 -c wire.pb.cc
In file included from /Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:43,
from wire.pb.cc:10:
/Users/sscaffid/local/include/google/protobuf/wire_format_lite.h:94: error: comma at end of enumerator list
/Users/sscaffid/local/include/google/protobuf/wire_format_lite.h:117: error: comma at end of enumerator list
/Users/sscaffid/local/include/google/protobuf/wire_format_lite.h:132: error: comma at end of enumerator list
In file included from wire.pb.cc:10:
/Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:303: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:304: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:305: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:306: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:307: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/wire_format_lite_inl.h:308: error: extra ‘;’
In file included from wire.pb.cc:11:
/Users/sscaffid/local/include/google/protobuf/descriptor.h:322: error: comma at end of enumerator list
/Users/sscaffid/local/include/google/protobuf/descriptor.h:341: error: comma at end of enumerator list
/Users/sscaffid/local/include/google/protobuf/descriptor.h:352: error: comma at end of enumerator list
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1206: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1223: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1243: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1249: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1257: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1264: error: extra ‘;’
/Users/sscaffid/local/include/google/protobuf/descriptor.h:1274: error: extra ‘;’
In file included from wire.pb.cc:13:
/Users/sscaffid/local/include/google/protobuf/wire_format.h:226: error: comma at end of enumerator list
make: *** [wire.pb.o] Error 1
From the question:
Solution:
Using the -pedantic option to GCC 4.2 makes it very angry with protobuf code. Don't use it.
When I run
$ cabal install OpenGLRaw
I get the following errors.
... ... ...
cbits/HsOpenGLRaw.c:78:20:
error: stdlib.h: No such file or directory
cbits/HsOpenGLRaw.c:79:19:
error: dlfcn.h: No such file or directory
cbits/HsOpenGLRaw.c: In function ‘hs_OpenGLRaw_getProcAddress’:
cbits/HsOpenGLRaw.c:97:0:
error: ‘NULL’ undeclared (first use in this function)
cbits/HsOpenGLRaw.c:97:0:
error: (Each undeclared identifier is reported only once
cbits/HsOpenGLRaw.c:97:0: error: for each function it appears in.)
cbits/HsOpenGLRaw.c:104:0:
warning: implicit declaration of function ‘dlopen’
cbits/HsOpenGLRaw.c:104:0:
error: ‘RTLD_LAZY’ undeclared (first use in this function)
cbits/HsOpenGLRaw.c:104:0:
warning: assignment makes pointer from integer without a cast
cbits/HsOpenGLRaw.c:115:0:
warning: implicit declaration of function ‘dlsym’
cbits/HsOpenGLRaw.c:115:0:
warning: assignment makes pointer from integer without a cast
cbits/HsOpenGLRaw.c:126:0:
warning: return makes pointer from integer without a cast
cabal: Error: some packages failed to install:
OpenGLRaw-1.1.0.1 failed during the building phase. The exception was:
ExitFailure 1
I just installed the latest Haskell Platform for OS X and ran cabal update for good measure.
Looks to me like ticket #5011 - XCode 4 on Mac + GHC 7.0.2 fails to link.
This is fixed in GHC 7.0.3 which will be part of the mid-April release of the Haskell Platform.
And alternative fix is to downgrade to the 2010.2 Haskell Platform.