Kastet
November 1st, 2004, 06:03 PM
I have problem compiling a program Visual C++ 2005 Express beta which I seem to be unable to resolve myself. This code:
#include "stdafx.h"
using namespace System;
class A {
public:
virtual void printMessage();
};
class B: public A {
public:
void printMessage(){
Console::WriteLine(L"Hello from B!!!");
}
};
int _tmain()
{
Console::WriteLine(L"Hello World");
B b;
b.printMessage();
Console::ReadLine();
return 0;
}
Gives linking error:
Compiling...
Hello World.cpp
Linking...
Hello World.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall A::printMessage(void)" (?printMessage@A@@UAEXXZ)
C:\Documents and Settings\Ilya\My Documents\Visual Studio\Projects\Hello World.NET\Debug\Hello World.NET.exe : fatal error LNK1120: 1 unresolved externals
And I cannot find anything wrong :(
#include "stdafx.h"
using namespace System;
class A {
public:
virtual void printMessage();
};
class B: public A {
public:
void printMessage(){
Console::WriteLine(L"Hello from B!!!");
}
};
int _tmain()
{
Console::WriteLine(L"Hello World");
B b;
b.printMessage();
Console::ReadLine();
return 0;
}
Gives linking error:
Compiling...
Hello World.cpp
Linking...
Hello World.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall A::printMessage(void)" (?printMessage@A@@UAEXXZ)
C:\Documents and Settings\Ilya\My Documents\Visual Studio\Projects\Hello World.NET\Debug\Hello World.NET.exe : fatal error LNK1120: 1 unresolved externals
And I cannot find anything wrong :(