objective-c++

XCode GCC-4.0 vs 4.2

I have just changed a compiler option from 4.0 to 4.2. Now I get an error: jump to case label crosses initialization of 'const char* selectorName' It works fine in 4.0 Any ideas? ...

Objective-C++ visibility question

I have linked a library with my program. It works fine. The only problem is that there visibility errors/warnings (thousands of them). They are all of the form: newlib::method() has different visibility (default) in newlib.a and (hidden) in AppDelegate.o It is always with AppDelegate.o. I have tried to set the visibility for both the...

Mac OS X linker error in Qt; CoreGraphics & CGWindowListCreate

Here is my .mm file #include "windowmanagerutils.h" #ifdef Q_OS_MAC #import </System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Headers/CGWindow.h> QRect WindowManagerUtils::getWindowRect(WId windowId) { CFArrayRef windows = CGWindowListCreate(kCGWindowListOptionOnScreenOnly, kCGNullWindowID...

Objective-C++ pre-compiled headers

I'm using a C++ library (it happens to be in an iPad application, but I'm not sure that should make any difference) and would really like to have the headers pre-compiled to speed up the builds, but xCode seems to run the pre-compiled header file through the C compiler rather than the C++ one. Is there a way to get it to use the right c...

Include Obj-C++ header from C++ source file

Consider the followng situation: MacFont.h struct MacFont : Font { // ... NSFont* font; }; MacFont will be implemented in MacFont.mm FontEngine.cpp: #if defined(OS_MAC) #include "MacFont.h" #elif // ... #endif //... In order to make it compiling, I should rename FontEngine.cpp to FontEngine.mm but I'm not allowed to. So w...

class NSCFData autoreleased with no pool in place

Hi, I have converted my NSString into string, and returning the same but the above error mentioned in the title is printing on console. Please suggest so that i could get away from this issue. my code is below: string stringFromNSString(NSString *inNSString) { return [inNSString UTF8String]; } ...

Is Objective-C++ a totally different language from Objective-C?

As the title says... are they considered different languages? For example if you've written an application using a combination of C++ and Objective-C++ would you consider it to have been written in C++ and Objective-C, C++ and Objective-C++ or all three? Obviously C and C++ are different languages even though C++ and C are directly comp...

GCD / block scoping in Objective-C++

I'm using GCD to speed up some calculations in a few C++ templates I'm working on. I've already done it successfully for several functions, but now I'm trying to get it to work for a member function and I've encountered this weird scoping problem. The code looks something like this: inline void op::factorOutGaussian(const double *x, c...

Mixing Qt and Cocoa via QMacNativeWidget- I'm having trouble showing a QDialog over an NSWindow.

Hi all, I am working on a plugin for a Cocoa application, and in order to use existing cpp code we decided to marry the Cocoa plugin with our existing Qt project via Objective-C++, which has been a lot to learn on the fly but is coming along well. Anyways, I am stumped by my current problem. The design of this plugin is such that the a...

Destructor in Objective-C++

I have an objective-C++ class which contain some honest C++ object pointers. When the Obj-C++ class is destroyed does it call dealloc immediately? If so, then is the best way to destroy the C++ class by putting delete obj in the dealloc method? ...

Ambiguous Class Namespace Issue

I... feel really silly asking this, but I'm not sure how to resolve the problem. This is a little snippit of my code (Objective-C++): #include "eq/eq.h" namespace eqOther { class Window : public eq::Window //<-- Error occurs here { public: Window( eq::Pipe* parent ) : eq::Window( parent ) {} void popup(); ...

A std::tr1::shared_ptr for Objective C++ on iPhone ???

Hi, I am mostly a C++ developer, recently I am writing iPhone applications. The memory management on iPhone is OK to me, due to resource limitation, it's encouraged to use reference counters rather than deep copy. One annoying thing is I have to manage the reference counters by myself: alloc means counter = 1; retain means counter++, r...

What Are Linear PCM Values

Hello All, I am working with audio in the iPhone OS and am a bit confused. I am currently getting input from my audio buffer in the form of pcm values ranging from -32767 to 32768. I am hoping to perform a dbSPL conversion using the formula 20LOG10(p/pref). I am aware that pRef is .00002 pascals, and would like to convert the pcm va...

What is the most basic class in C++

I hope this question is not too silly, but what is the most basic class in standard C++? object? Object? class MyObject : public object{ ... and I get "Expected class-name before token{" Is there any map, diagram or image that shows standard c++ classes inheritance? Something like this but for C++ ? ...

who released my object on the handler file?

Hi guys, I'm a newbie on the iphone development world.. I started a new project, I used it to test what I learned about objective c, it basically sends and recives data from my local server, then, I store some of that data inside the class, it works fine. Everything is on the command line. my class definition: @interface MyClient : N...

How to write Portable C/C++/Objective-C++ code to target Apple iPhone/Mac OSX?

I'm working with some C/C++ code that runs on Win32 and also VxWorks. It uses #ifdef WIN32 to switch to platform specific implementations. I've been using the code on the iPhone and I want to update it and keep it as portable as possible, but I'm not sure what's the best practice. So far I've been using #ifdef __APPLE__ blocks. What ...

CMake croscompile problem with CXX_FLAGS in linker

I have following toolchain for iPhone crosscompilation on mac os x: # Platform Info SET (CMAKE_SYSTEM_VERSION 1) SET (CMAKE_SYSTEM_PROCESSOR arm) # SDK Info SET (SDKVER "3.0") SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer") SET (SDKROOT "${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk") SET (CMAKE_OSX_SYSROOT "${SDKROOT}") SET (...

Accessing ivars of an objective-c class within c++ function

I have an objective-c class, which has a string ivar which I need to change when a callback function is called. The trouble is that the callback is in c++, and I therefore cannot access the ivars of the objective-c class in that c++ function. The callback must be in c++ that, cannot change. I realize that there are other ways this could ...

Using c++ template an argument to an objective-c method.

How can I use a c++ template as an a parameter to an objective-c method? essentially I want to do something like this: template<typename T> - (void)method:(T)arg but that doesn't work. according to this document this is possible however it does not provide any examples. Does anyone know how tot do this? ...

Non 8 Byte aligned memory access causes memory access violation on iPhone 3GS with iOS 4.0

Hi, consider the following Objective-C++ iPhone Application (TestMemAppDelegate.mm). It crashes with an EXC_BAD_ACCESS on the iPhone (3GS with iOS 4.0). It works fine in the Simulator. It is clearly a memory alignment thing, because it works fine on the iPhone if the "DataA" struct starts on a 8 Byte border. Can anyone explain the caus...