Following is my C++ code:
#include<iostream>
#include<string.h>
extern "C" void wrapper(struct NB*, int );
struct AssetDbFilter {
std::string attribute;
std::string value;
};
class NB {
public:
void myTest(int a);
};
Following is C++ code:
#include<iostream>
#include<string.h>
#include "test.h"
using namespace std;
void NB :: myTest (int a) {
cout << a;
}
void wrapper(NB* nb, int a) {
nb->myTest(a);
}
Following is my c code:
#include<stdio.h>
#include "test.h"
void wrapper(struct NB* ,int );
int main()
{
AssetDbFilter* assetdb;
struct NB* nb;
wrapper(nb, 5);
}
I am not able to execute this code.
I am calling C++ member function from a C code. When I execute this C file as g++ test.c I am getting following error:
/tmp/ccr1IaLa.o: In function `main':
test1.c:(.text+0x15): undefined reference to `wrapper'
collect2: error: ld returned 1 exit status
Can anyone tell me how can I resolve this?