0

I have C++ files: C.cpp and C.h

//C.h #ifndef __ThreeMoreOpenCV__SourceC__ #define __ThreeMoreOpenCV__SourceC__ #include <iostream> class C { public: static void Cmethod (); }; #endif //C.cpp #include "SourceC.h" using namespace std; void Cmethod() { printf("ff"); } 

Also I have Wrapper.h/.mm

//Wrapper.h #import <Foundation/Foundation.h> @interface CVWrapper : NSObject +(void)returnCmethod; @end //Wrapper.mm #import "Wrapper.h" #import "C.h" @implementation CVWrapper +(void)returnCmethod { C::Cmethod(); } @end 

I have no idea but i'm getting an error like:

"C::Cmethod()", referenced from: +[Wrapper returnCmethod] in Wrapper.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation).

Can anybody tell me what is correct way to call function?

1
  • Edited the title since it was extremely misleading. Also, I would recommend re-naming your 'C' class to something more descriptive. Commented Mar 24, 2013 at 20:11

1 Answer 1

4

You haven't actually implemented the Cmethod function in your C class. You need to implement it with C:: in the function header, like:

void C::Cmethod() { printf("ff"); } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.