Hi

I am writing a function in C++

extern "C"
{
    __declspec(dllexport) void CreateInputFilter()
    {
        ITestPtr pTest = createInstance<ITest>(m_Test);

    }
}

But I am getting this error

m_Test' : undeclared identifier

The main thing is above this function I have written the same code above in another function but there it is working fine.

Definition of the function is

int cls ::CreateDocument(char* filein, char* fileout, char* config)
{
       ITestPtr pTest = createInstance<ITest>(m_Test);
}

I am not able to understand why the error is coming in the former one.

kindly advice
Regards
Karan

Recommended Answers

All 2 Replies

m_Test is apparently a member of cls class. CreateInputFilter() is not a member of that class, so it doesn't know what m_Test is.

Hi

If I change the definition to

extern "C"
{
__declspec(dllexport) void cls :: CreateInputFilter()
{
ITestPtr pTest = createInstance<ITest>(m_Test);

}
}

I am getting another error

error C2375: 'cls :: CreateInputFilter()' : redefinition; different linkage

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.