Refering a header file of unmanaged project in managed project

S

Sarwan

Hello everybody

I have a solution in which there is an unmanaged MFC application. Then
i added a new managed .Net Windows Form application. I was trying to
refer an header file of unmanaged project into the my managed project.
But it leads to link error.

Form1.obj : error LNK2001: unresolved external symbol "public: void
__thiscall FormViewer::CFormViewer::StartViewer(void)" (?
StartViewer@CFormViewer@FormViewer@@$$FQAEXXZ)

The class which we refered in managed will refer other classes.

First of all such refering to other project is allowed.

Thanking you
 
B

Ben Voigt

Sarwan said:
Hello everybody

I have a solution in which there is an unmanaged MFC application. Then
i added a new managed .Net Windows Form application. I was trying to
refer an header file of unmanaged project into the my managed project.
But it leads to link error.

Form1.obj : error LNK2001: unresolved external symbol "public: void
__thiscall FormViewer::CFormViewer::StartViewer(void)" (?
StartViewer@CFormViewer@FormViewer@@$$FQAEXXZ)

Did you link with the library file from the unmanaged project, where the
functions are (which are in .cpp files, not the header file)

Possibly you used a #include for a C++ class from inside a namespace... that
won't work. Unless you use extern "C", your fully qualified class names
must exactly match the ones used by the library, including namespace,
because the compiler decorated name contains the namespace.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top