Using STL within the Mac 10.5 SDK - xcode

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.

Related

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.

Xcode watch 'invalid expression'

I'm stepping through some Swift code in Xcode and I'd like to watch values. Following the advice in many of the answers here (e.g. this one) I can add the expression to the local variables window.
The breakpoint I am on is the last line of this fragment from the Starscream library (by daltoniam) which I include as a pod.
for i in 0..<dataLength {
buffer[offset] = data[i] ^ maskKey[i % MemoryLayout<UInt32>.size]
offset += 1
}
var total = 0
I've added two expressions to watch:
buffer[0] and
MemoryLayout<UInt32>.size
For both the value I see is "invalid expression":
These expressions are clearly are not invalid, if they were the code would have thrown an exception when they were encountered executing the previous few lines. What am I missing? How should I watch and not get 'invalid expression'
N.B. If I call p buffer[0] from the lldb prompt I get the cryptic error:
(lldb) p buffer[0]
error: warning: :12:9: warning: initialization of variable
'$__lldb_error_result' was never used; consider replacing with assignment to '_'
or removing it
var $__lldb_error_result = __lldb_tmp_error
~~~~^~~~~~~~~~~~~~~~~~~~
_
error: :19:5: error: value of type 'WebSocket' has no member
'$__lldb_wrapped_expr_72'
$__lldb_injected_self.$__lldb_wrapped_expr_72(
^~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
I have tried changing the podfile (as per Jim's answer) so that it explicitly gets the debug code:
pod 'Starscream', '~> 3.0.6', :configuration => 'Debug'
and I have even gone as far as removing the pods, cloning Starscream, and including the source code as a sub-project. I still get the same error.
An expression that accesses buffer[0] where buffer is a UnsafeMutablePointer works correctly in the expression parser when I'm stopped in some simple function. And from your experience with the expr command directly, it looks like your problem is not with this particular expression. Rather it looks like there's something about the context you are stopped in that's tripping up the expression parser altogether.
Make sure that you aren't using binary cocoapods's and that you've rebuilt all your code and all the pods you are using have been rebuilt from scratch with the same swift compiler. At present, lldb and swiftc are version locked - lldb can only debug programs built with the swiftc that it ships with.
If that doesn't fix the issue, then we'll need to figure out what about the particular function you are stopped in that's causing the problem. This seems like the sort of thing better dealt with by filing a bug with the swift project (http://bugs.swift.org).

NativeScript "File Not Found With angled Include; use 'quote' instead"

I'm trying to add the VKVideoPlayer CocoaPod to a NativeScript app, but the build fails with 'DDLog.h' file not found with <angled> include; use "quotes" instead.
This include is in a library (VKFoundation) that is referenced by the VKVideoPlayer. This VKFoundation.h file in turn references the DDLog.h (from CocoaLumberjack) and DTCoreText.h (from DTCoreText).
All of these libraries are pulled in by the VKVideoPlayer Pod.
Here is the relevant error from the command line...
/Users/burkeholland/dev/burkeholland/nativescript-video-player/demo/platforms/ios/Pods/VKFoundation/Classes/ios/VKFoundation.h:6:9: error:
'DDLog.h' file not found with <angled> include; use "quotes" instead
#import <DDLog.h>
^~~~~~~~~
"DDLog.h"
/Users/burkeholland/dev/burkeholland/nativescript-video-player/demo/platforms/ios/Pods/VKFoundation/Classes/ios/VKFoundation.h:7:9: error:
'DTCoreText.h' file not found with <angled> include; use "quotes" instead
#import <DTCoreText.h>
^~~~~~~~~~~~~~
"DTCoreText.h"
2 errors generated.
The error can be reproduced from this GitHub project.
The error itself indicates that one of the referenced headers (DDLog.h) is referenced with <, but the compiler cannot find it. So it suggests you to try using " quotes instead of angles (<). This is a common error raised by XCode when it's unable to find referenced header.
As per your problem, I believe the problem is with VKFoundation Cocoapod, which is a dependency of VKVideoPlayer Pod. Here's a related issue:
https://github.com/viki-org/VKFoundation/issues/5
You can try using the suggested Podfile and see if it works on your side.

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)."*

boost/unordered_set: compile error with mingw ()

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.

Resources