VC++.NET 2003, Managed/Unmanaged code

B

Bill S.

Hi,

I'm trying to create an unmanaged instance within a managed object. In the
one module, I've constructed an unmanaged class that makes a lot of API
calls. It compiles with no errors. In the other module, when an instance of
the unmanaged class is created, a Link error is encountered. (Unresolved
external symbol ...). If comment out the line of code: uc = new
MyUnmanagedClass(), the app builds with no errors. Can anybody help?

Thanks.

//Unmanaged module ///////////////////////////////////////////
using namespace System::Runtime::InteropServices;
#include "stdafx.h"
#include <windows.h>

class MyUnmanagedClass{
//Windows API Stuff.
};

//Managed module /////////////////////////////////////////////
class Form1{
private:
MyUnmanagedClass *uc;

public:
Form1()
{
//A Link error occurs here.
uc = new MyUnmanagedClass();
}
};
 
A

adebaene

Bill said:
Hi,

I'm trying to create an unmanaged instance within a managed object. In the
one module, I've constructed an unmanaged class that makes a lot of API
calls. It compiles with no errors. In the other module, when an instance of
the unmanaged class is created, a Link error is encountered. (Unresolved
external symbol ...). If comment out the line of code: uc = new
MyUnmanagedClass(), the app builds with no errors. Can anybody help?

You're missing the source file or library that defines the operation(s)
in MyUnmangedClass that is(are) marked as "Undefined" in the linker
output. Show the full error message if you need more help.

Arnaud
MVP - VC
 

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