objective-c++

Symbol Not Found, expected in Flat Namespace ObjC++

Hello, I've got probably what is a simple problem, but there's no informative errors or warnings during compile to alert me to what is going wrong. I've got a Objective-C++ app that includes a C++ main and ObjC header files. It builds fine, but when run, it gives this error message: Dyld Error Message: Symbol not found: _OBJC_CLASS...

Objective-C++ compiles for iPhone, but not simulator

I have a C++ library I want to add to my iphone project. In one header file I declare @interface a { cppvirtualclass V; } This compiles fine for the iPhone device with Release settings. However it refuses to compile for the Simulator with or without debug info. It give the error error: type 'V' has virtual member functions. Is...

What's the difference between alloca(n) and char x[n]?

What is the difference between void *bytes = alloca(size); and char bytes[size]; //Or to be more precise, char x[size]; void *bytes = x; ...where size is a variable whose value is unknown at compile-time. ...

how to return C++ pointer in objective-C++

I have the following objective-C++ header with the simple method to return this pointer. @interface MyObj { MyCPPObj * cpp; } -(MyCPPObj *) getObj; I have created the simple method @implementation MyObj -(MyCPPObj *) getObj { return cpp; } Everything seems to work until I actually try to use the object in another file newObj =...

Released object crashes app

I am using objective-C++ (+Boost) for iPhone development. I am in a rather tight loop and need to allocate and release a certain object. The code is something like this. for (int i=0;i<100;i++) { opt = [[FObj alloc] init]; //do stuff with opt [opt release]; } The FObj object is something like @interface FObj MyCPPObj ...

Problem with header files of ARToolkitPlus after making the ARToolKitPlus dylib!

I'm writing this Augmented Reality app for the iPhone and I'd decided to use ARToolKitPlus for it. Using QMake, I created the xcode project file and subsequently the libArToolKitPlus.dylib I tried to compile and run the sample files "simple" and "multi" which worked well. Now all other attempts that I tried to create another project and...

boost::shared_ptr in Objective-C++

This is a better understanding of a question I had earlier. I have the following Objective-C++ object @interface OCPP { MyCppobj * cppobj; } @end @implementation OCPP -(OCPP *) init { cppobj = new MyCppobj; } @end Then I create a completely differently obj which needs to use cppobj in a boost::shared_ptr (I have no choic...

Use C++ with Objective-C in XCode

I want to use/reuse C++ object with Objective-C. I have a hello.h that has the class definition, and hello.cpp for class implementation. class Hello { int getX() ... }; And I use this class in Objective-C function. #include "hello.h" ... - (IBAction) adderTwo:(id)sender { Hello *hi = new Hello(); int value = hi->g...

Mixing Objective-C and C++

Hello, I'm trying to mix together some Objective-C code with C++. I've always heard it was possible, but I've never actually tried it before. When I try to compile the code, I get a bunch of errors. Here's a simple example I've created which illustrates my problems: AView.h #import <Cocoa/Cocoa.h> #include "B.h" @interface AView : ...

Why is my app running

I have compiled my iPhone app with setting (Device, Release). I install it on the test machine and it runs with no problem. Here's the problem. The app is linked to a C++ library. The compilation on the simulator has no errors. However the device compilation produces 568 errors, mostly about different visibilities w.r.t AppDelegate.o. ...

C++ reference type as instance variable in Objective-C++

C++ reference types as instance variables are forbidden in Objective-C++. How can I work around this? ...

Parameter becoming zero somewhere

Hey guys, Something really weird is happening: when I call foo(100*1.0f), somewhere along the line that becomes 0. To verify I put a breakpoint on foo(), and it indeed is zero and it indeed gets called with 100*1.0f. The code is in Obj-C++. Here is the calling function in XCode's GDB frontend, as you can see, score*scoreMultiplier is ...

Stopping a runaway Lua subprocess

I have embedded Lua in an Objective-C application using LuaObjCBridge. I need to know how to stop the Lua process if it taking too much time (infinite loop?). Would running it in a separate thread help? ...

C++ stack in Objective-C++

I'd like to use a C++ stack type in Objective-C, but I'm running into some issues. Here's a sample of what I would like to do: #import <stack> #import <UIKit/UIKit.h> @interface A : NSObject { stack<SEL> selectorStack; } @end Unfortunately, this doesn't compile. After messing around with the code for a while and trying differe...

NSStringFromPoint disappears under Objective-C++

The function NSStringFromPoint disappears when I compile my code using objective-C++, but it's fine under objective-C. How can I make objective-C++ see that function? If I compile under Objective-C++ it says: error: 'NSStringFromPoint' was not declared in this scope error: 'NSStringFromRect' was not declared in this scope error: 'NSEq...

How to static analyze C++ and Objective-C++ code?

The "Build and analyze" option doesn't seem to work for .cpp and .mm files. I tried "clang --analyze" on individual files without any standard #includes and it works well. However I'm not able to run it on my Xcode project. I couldn't figure out a way to make clang find the standard #includes like even UIKit.h. Any clues? ...

Noob Objective-C/C++ - Linker Problem/Method Signature Problem

There is a static class Pipe, defined in C++ header that I'm including. The static method I'm interested in calling (from Objective-c) is here: static ERC SendUserGet(const UserId &_idUser,const GUID &_idStyle,const ZoneId &_idZone,const char *_pszMsg); I have access to an objetive-c data structure that appears to store a copy of us...

Creating an Objective-C++ Static Library in Xcode

So I've developed an engine for the iPhone with which I'd like to build a couple different games. Rather than copy and paste the files for the engine inside of each game's project directory, I'd a way to link to the engine from each game, so if I need to make a change to it I only have to do so once. After reeding around a little bit, ...

Size already defined

I was messing with my Objective-C++ namespace today. I found that Handle, Size and Duration are already defined in ObjC++. What are they defined to be and where are they defined? I have only #imported Foundation/Foundation.h ...

Compare two Xcode build settings

I have a project where I use two build settings predominantly. Unfortunately today something went wrong. One compiles and the other doesn't. How can I compare the two build settings in XCode to see what the differences are? (For those interested, the error I get in one build is jump to case label crosses initialization of 'const char*...