Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Objective-c > Mixing Objectiv...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 895 of 1009
Post > Topic >>

Mixing ObjectiveC and C++, link problems..

by SpreadTooThin <bjobrien62@[EMAIL PROTECTED] > Aug 25, 2007 at 10:39 AM

I had an application (a dylib) that was all in C++
I wanted to call some ObjectiveC methods from the C++ code.
So I renamed the C++ code from .cpp to .mm
I built the application and it build without any problems.
As a test I added a new ObjectiveC class to the project.

this is first1.h

#im****t <Cocoa/Cocoa.h>
@[EMAIL PROTECTED]
 first1 : NSObject {

}

- (int) test;
@[EMAIL PROTECTED]
 first1.mm

#im****t "first1.h"
@[EMAIL PROTECTED]
 first1
- (int) test
{
        return 1;
}

@[EMAIL PROTECTED]
 my application in one of the C++ methods i did this:

#im****t <first1.h>
void MyMethod(void)
{
        first1 *x = [[first1 alloc] init];
        int y = [x test];
        y = y - 1;
}

I built the application and get some link errors...
Tool:0: internal link edit command failed
Tool:0: /Users/me/Desktop/development/my projects/project/
first/build/first.build/Development/first PPC.build/Objects-normal/
ppc/
first.o reference to undefined _objc_msgSend
Tool:0: /Users/me/Desktop/development/my projects/project/
first/build/first.build/Development/first PPC.build/Objects-normal/
ppc/
first.o reference to undefined .objc_class_name_first1
Tool:0: NEXT_ROOT environment variable ignored because -syslibroot
specified
Tool:0: .objc_class_name_first1
Tool:0: Undefined symbols:
Tool:0: warning prebinding disabled because of undefined symbols
Tool:0: _objc_msgSend


Does anyone know what I've done wrong?
Should I be linking with some library that I'm not?
I don't see this error for the Universal Binary build.. or maybe xcode
doesn't make it that far.
 




 1 Posts in Topic:
Mixing ObjectiveC and C++, link problems..
SpreadTooThin <bjobrie  2007-08-25 10:39:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 5:43:45 CDT 2008.