boost/unordered_set: compile error with mingw () - boost

I have a piece of code that uses boost's unordered_set
#include <boost/unordered_set.hpp>
boost::unordered_set<string> mySet(100);
It compiles and works fine with gcc under unix. When I try cross compiling with mingw32 (gmake 3.8.1) I get the following message:
In file included
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/functional/hash/detail/hash_float.hpp:17,
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/functional/hash/hash.hpp:15,
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/functional/hash.hpp:6,
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/unordered/unordered_set.hpp:17,
from /usr/i686-pc-mingw32/sys-root/mingw/include/boost/unordered_set.hpp:16,
from /mnt/VirtualBoxShare/percolator/src/ProteinProbEstimatorHelper.h:33,
from /mnt/VirtualBoxShare/percolator/src/ProteinProbEstimator.cpp:28:
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:105: error: expected unqualified-id before 'unsigned'
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:105: error: expected ';' before 'unsigned'
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:105: error: declaration does not declare anything
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:114: error: expected unqualified-id before 'unsigned'
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:114: error: expected ';' before 'unsigned'
/usr/i686-pc-mingw32/sys-root/mingw/include/boost/cstdint.hpp:114: error: declaration does not declare anything
To me it seems like a template related problem; any suggestions?
Thank you,
Mattia
[EDIT]
other boost functionalities are available, for example the lexical cast
#include <boost/lexical_cast.hpp>

It seems that some typedef breaks the boost cstdint header, which looks like
103 using ::int8_t;
104 using ::int_least8_t;
105 using ::int_fast8_t;
106 using ::uint8_t;
107 using ::uint_least8_t;
108 using ::uint_fast8_t;
on my system. So, some hero probably defined "#define uint8_t" instead of "typedef ... uint8_t", and this code consequently breaks.
You might try to to modify your boost/config/platform/win32.hpp and, if that helps, report the bug to the mingw developers.

Related

how to build gcc 11 cross compiler for jetson nano (arm64)

I'm following this guide but when I try to build the c++ library I get the following fatal error.
../../../../gcc-11.1.0/libsanitizer/asan/asan_linux.cpp: In function ‘void __asan::AsanCheckIncompatibleRT()’:
../../../../gcc-11.1.0/libsanitizer/asan/asan_linux.cpp:199:21: error: ‘PATH_MAX’ was not declared in this scope
199 | char filename[PATH_MAX];
| ^~~~~~~~
../../../../gcc-11.1.0/libsanitizer/asan/asan_linux.cpp:200:35: error: ‘filename’ was not declared in this scope; did you mean ‘rename’?
200 | MemoryMappedSegment segment(filename, sizeof(filename));
| ^~~~~~~~
|
This appears to be a bug in libsanitizer/asan/asan_linux.cpp. It seems to find the wrong limits.h file.
I was able to work around it by modifying asan_linux.cpp as follows.
-#include <limits.h>
+#include <linux/limits.h>

gsoap adding "custom/chrono_time_point.h" "WARNING": missing ';' or invalid type specified

after uncommenting in typemap.dat the following line:
xsd__dateTime = #import "custom/chrono_time_point.h" | xsd__dateTime
I run wsdl2h and everything is fine..
but later in soapcpp2 I'm getting the following warning:
custom/chrono_time_point.h(70): *WARNING*: invalid type specified (missing ';' or type name used as non-type identifier?)
what is this?
Edit
I use gsoap windows from vcpkg.
You do not need to #include "custom/chrono_time_point.h" in your code base after adding that line to your typemap.dat. Adding this line suffices to use std::chrono::system_clock::time_point for XML xsd:dateTime values.
Note that #import custom/chrono_time_point.h is used by soapcpp2 to register the std::chrono::system_clock::time_point serializer.
The serialization implementation is custom/chrono_time_point.cpp which should also be compiled together with the project.

How to get better error output with Visual Studio

I was working on a project and got the following errors
Error (active) the default constructor of "Input" cannot be referenced -- it is a deleted function EquationSolver c:\Users\Kim\Documents\Visual Studio 2015\Projects\EquationSolver\EquationSolver\main.cpp 10
Error C2280 'Input::Input(void)': attempting to reference a deleted function EquationSolver <project_dir>\main.cpp 10
Since it is almost impossible to find the cause of the error from this, I tried compiling with gcc with -Wall and got following output
main.cpp: In function 'int main()':
main.cpp:10:9: error: use of deleted function 'Input::Input()'
Input input;
^~~~~
In file included from main.cpp:2:0:
Input.hpp:16:7: note: 'Input::Input()' is implicitly deleted because the default definition would be ill-formed:
class Input
^~~~~
Input.hpp:16:7: error: use of deleted function 'Expressions::Expressions()'
In file included from Input.hpp:11:0,
from main.cpp:2:
Expressions.hpp:8:7: note: 'Expressions::Expressions()' is implicitly deleted because the default definition would be ill-formed:
class Expressions
^~~~~~~~~~~
Expressions.hpp:8:7: error: uninitialized reference member in 'class Expressions'
Expressions.hpp:17:8: note: 'Expressions::Vec& Expressions::left' should be initialized
Vec& left;
^~~~
Expressions.hpp:8:7: error: uninitialized reference member in 'class Expressions'
class Expressions
^~~~~~~~~~~
Expressions.hpp:18:8: note: 'Expressions::Vec& Expressions::right' should be initialized
Vec& right;
^~~~~
This output is much more verbose and quickly helped me find the origin, which was a misplaced & (class member should be Vec left, was Vec& left).
Is it possible to make Visual Studio as verbose?
When putting Visual Studio to /Wall, I get >1800 warnings, most completely unrelated to my project, but I still only get those two errors.

Can't compile CapacitiveSensor example in Arduino

I am trying to use the Capacitive Sensors Library from the Arduino Playground with Arduino 1.5.3 for Intel Galileo.
While trying to compile the example Sketch of the library with nothing touched I get the following error:
Arduino: 1.5.3 (Windows 7), Board: "Intel® Galileo"
CapacitiveSensor.cpp: In constructor
'CapacitiveSensor::CapacitiveSensor(uint8_t, uint8_t)':
CapacitiveSensor.cpp:30:63: error: 'F_CPU' was not declared in this
scope CapacitiveSensor.cpp:43:10: error: 'PinDescription' has no
member named 'ulPin' CapacitiveSensor.cpp:44:10: error:
'PinDescription' has no member named 'pPort'
CapacitiveSensor.cpp:45:31: error: 'portModeRegister' was not declared
in this scope CapacitiveSensor.cpp:46:9: error: base operand of '->'
is not a pointer CapacitiveSensor.cpp:48:9: error: 'PinDescription'
has no member named 'ulPin' CapacitiveSensor.cpp:49:10: error:
'PinDescription' has no member named 'pPort'
CapacitiveSensor.cpp:51:9: error: base operand of '->' is not a
pointer CapacitiveSensor.cpp:52:12: error: base operand of '->' is not
a pointer CapacitiveSensor.cpp:55:18: error: 'noInterrupts' was not
declared in this scope CapacitiveSensor.cpp:57:16: error: 'interrupts'
was not declared in this scope CapacitiveSensor.cpp: In member
function 'void CapacitiveSensor::set_CS_Timeout_Millis(long unsigned
int)': CapacitiveSensor.cpp:133:73: error: 'F_CPU' was not declared in
this scope CapacitiveSensor.cpp: In member function 'int
CapacitiveSensor::SenseOneCycle()': CapacitiveSensor.cpp:141:18:
error: 'noInterrupts' was not declared in this scope
CapacitiveSensor.cpp:151:16: error: 'interrupts' was not declared in
this scope
I downloaded the files and imported the "CapacitiveSensor"-Folder into (I did those steps one after the other, not at the same time.):
The libraries folder under Documents/arduino/.
The libraries folder in the arduino folder where the arduino.exe is stored.
Onto arduino-1.5.3/hardware/libraries/ (because this is mentioned on the site where I downloaded it)
And I tried this: Here Because it seemed to be the same error as I had. But it didnt work.
I also deleted my Arduino and reinstalled it.
Anyone has an Idea?
Thanks in advance,
Clemens
There is a similar question on the Arduino forum but I don't know if your issue is exactly the same: [FIXED][CapacitiveSensor] Can't compile with Due (port manipulation)
It doesn't look like the Arduino folks are very responsive. The user modified register names and eventually put his own library out there.
*"...changed the uint8_t registers to RwReg (compiler doesn't complain) and I replaced the use of portModeRegister(PIN) with simple pinMode(PIN, MODE) calls (it's slower but it works)."*

Using STL within the Mac 10.5 SDK

Hopefully this is more relevant to StackOverflow than mac.stackexchange...
I am using ARToolkit for an augmented reality project, and in order to make it work under Mac I need to run the 10.5 SDK.
My problem is that I cannot seem to include any of the STL header files...especially vector.
Is there any sort of wrapper or workaround that I can use? I am basically compiling straight C code, and would like to make use of some of the nicer features of the STL framework to speed up development...
Edit:
In closer inspection, it appears that ARToolkit is including std_vector at some point in its include path.
Error snippet:
Bits/c++allocator.h: No such file or directory
Expected template-name before '<' token
Expected `{' before '<' token
Expected unqualified-id before '<' token
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/iosfwd
Bits/c++locale.h: No such file or directory
Bits/c++io.h: No such file or directory
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/stl_algobase.h
Bits/c++config.h: No such file or directory
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/stl_vector.h
Expected type-specifier before 'allocator'
Expected '>' before 'allocator'
'input_iterator_tag' has not been declared
'forward_iterator_tag' has not been declared
'input_iterator_tag' has not been declared
'forward_iterator_tag' has not been declared
'input_iterator_tag' has not been declared
'forward_iterator_tag' has not been declared
There are no arguments to '__N' that depend on a template parameter, so a declaration of '__N' must be available
(if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
Expected nested-name-specifier before 'iterator_traits'
Expected initializer before '<' token
There are no arguments to '_IterCategory' that depend on a template parameter, so a declaration of '_IterCategory' must be available
Expected nested-name-specifier before 'iterator_traits'
Expected initializer before '<' token
There are no arguments to '_IterCategory' that depend on a template parameter, so a declaration of '_IterCategory' must be available
Expected nested-name-specifier before 'iterator_traits'
Expected initializer before '<' token
There are no arguments to '_IterCategory' that depend on a template parameter, so a declaration of '_IterCategory' must be available
/Users/espais/research/artoolkit/trunk/artoolkit/examples/newproject/newproject.cpp
Expected `}' at end of input
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/stl_bvector.h
Expected template-name before '<' token
Expected `{' before '<' token
Expected unqualified-id before '<' token
You might need to make your file a .mm file (Objective-C++) instead of .m (Objective-C).
Other than that, there shouldn't be any trouble doing #include <vector>.
Basically, there was some trickery that had to be done behind the scenes.
I had to update my local SDK (turns out that ARToolkit does support newer versions, regardless of what THEIR documentation says), and then the STL libraries worked.

Resources