Returning value from C++ into Obj-C?
I'm banging my head for a while with how to return a value from some C++ into Obj-C. Here are my files:
XMLParsing.h
#include <iostream>
#include <libxml/xmlreader.h>
#include <string>
#include <stdlib.h>
using namespace std;
class XMLParsing {
int i;
public:
int outputAnArray();
};
XMLParsing.cpp
#include "XMLParsing.h"
int outputAnArray() {
return 1;
}
MyTest.mm
XMLParsing *parser = new XMLPar开发者_如何学Csing();
parser->outputAnArray();
This raises: Undefined symbols for architecture i386: ld: symbol(s) not found for architecture i386
Any hint would be greatly appreciated.
The XMLParsing.cpp should be like:
#include "XMLParsing.h"
int XMLParsing::outputAnArray() {
return 1;
}
Sorry for the late answer.
精彩评论