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 C++ and ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 893 of 1009
Post > Topic >>

Mixing C++ and ObjectiveC

by SpreadTooThin <bjobrien62@[EMAIL PROTECTED] > Aug 25, 2007 at 05:21 PM

I had an application 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 first.h
#im****t <Cocoa/Cocoa.h>
@[EMAIL PROTECTED]
 first1 : NSObject {

}
- (int) test;
@[EMAIL PROTECTED]
 first.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/brianobrien/Desktop/development/Real Basic/plugins/
first/build/first.build/Development/first PPC.build/Objects-normal/ppc/
first.o reference to undefined _objc_msgSend
Tool:0: /Users/brianobrien/Desktop/development/Real Basic/plugins/
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?
 




 4 Posts in Topic:
Mixing C++ and ObjectiveC
SpreadTooThin <bjobrie  2007-08-25 17:21:31 
Re: Mixing C++ and ObjectiveC
SpreadTooThin <bjobrie  2007-08-25 10:30:31 
Re: Mixing C++ and ObjectiveC
David Phillip Oster <o  2007-08-26 01:15:50 
Re: Mixing C++ and ObjectiveC
SpreadTooThin <bjobrie  2007-08-26 19:41:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Fri Jul 25 23:49:41 CDT 2008.