Basically I do not know how to call function from a .mm class to a C funtion defined in a .m file
here in my .m vector file
- Code: Select all
struct dVector
{
float m_x;
float m_y;
float m_z;
float m_w;
};
struct dVector InitVector (float x, float y, float z, float w);
struct dVector Scale (struct dVector* me, float s);
struct dVector AddVector (struct dVector* A, struct dVector* B);
struct dVector SubVector (struct dVector* A, struct dVector* B);
...
here is my .mm iNewtion class
- Code: Select all
#import <Foundation/Foundation.h>
@class Entity;
@interface iNewton : NSObject
{
void* m_world;
}
-(id) init;
-(void) dealloc;
-(void*) CreateBox: (Entity*) ent: (int) shapeId;
...
@end
I can not call any Vector function or other function from the .mm class, here is tthe implementatin of CreateBox in a .mm file
- Code: Select all
-(void*) CreateBox: (Entity*) ent: (int) shapeId
{
struct dVector minBox;
struct dVector maxBox;
// this is fine, because it is a class member on Entityr
[ent GetBBox: &minBox: &maxBox];
// this reports a link error, because ther are C funtion in a .m file
struct dVector size = SubVector(&maxBox, &minBox);
struct dVector origin = AddVector (&maxBox, &minBox);
...
return NewtonCreateBox ((NewtonWorld*) world, size.m_x, size.m_y, size.m_z, shapeId, &offset.m_front.m_x);
}
I get these complier errors
Building target “tutorial_102_AddingRigidBody” of project “newton_iPhone” with configuration “Debug_Emulation” — (3 errors)
cd /Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newton_iPhone
setenv MACOSX_DEPLOYMENT_TARGET 10.5
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk -L/Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newton_iPhone/build/Debug_Emulation-iphonesimulator -L/Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newton_iPhone/../sdk -F/Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newton_iPhone/build/Debug_Emulation-iphonesimulator -filelist /Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newton_iPhone/build/Debug_Emulation-iphonesimulator/tutorial_102_AddingRigidBody.build/Objects-normal/i386/tutorial_102_AddingRigidBodies.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework CoreGraphics -lnewton_iPhoneEmulation -o /Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newton_iPhone/build/Debug_Emulation-iphonesimulator/tutorial_102_AddingRigidBodies.app/tutorial_102_AddingRigidBodies
Undefined symbols:
"AddVector(dVector*, dVector*)", referenced from:
-[iNewton CreateBox::] in iNewton.o
"SubVector(dVector*, dVector*)", referenced from:
-[iNewton CreateBox::] in iNewton.o
"Scale(dVector*, float)", referenced from:
-[iNewton CreateBox::] in iNewton.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
"AddVector(dVector*, dVector*)", referenced from:
-[iNewton CreateBox::] in iNewton.o
"SubVector(dVector*, dVector*)", referenced from:
-[iNewton CreateBox::] in iNewton.o
"Scale(dVector*, float)", referenced from:
-[iNewton CreateBox::] in iNewton.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Build failed (3 errors)
does anyone knows what I need to do to solve this problem, I am trying since yesterday but I can not figure out what to do.
Ther must be a way to do that, teh docimenation in objective C say teh .m file can have class and C files.
why I can not call C funtions from and .mm file them?