ASP.NET C++ LNK1120 error

S

sna19

Hi all.

I try to run following code in C++.NET ASP.NET project. The code is:

FolderItem.cpp
============

#include "stdafx.h"
#include "FolderItem.h"

FolderItem::FolderItem(int i){ }
FolderItem::~FolderItem(){ }

FolderItem.h
==========

#ifndef EA_06B8EBB7_4E18_4f42_9F1E_3B0DF280308D__INCLUDED_
#define EA_06B8EBB7_4E18_4f42_9F1E_3B0DF280308D__INCLUDED_

class FolderItem{

public:
FolderItem(int i);
virtual ~FolderItem();
};
#endif


I try to run this code and get following errors:

ContentManager error LNK2001: unresolved external symbol "void __cdecl
operator delete(void *)" (??3@$$FYAXPAX@Z)
ContentManager error LNK2001: unresolved external symbol "void
__stdcall `eh vector destructor iterator'(void *,unsigned int,int,void
(__thiscall*)(void *))" (??_M@$$FYGXPAXIHP6EX0@Z@Z)
ContentManager fatal error LNK1120: 2 unresolved externals

If I put constructor / destructor inside header file, compilation
successes.
Is somebody know the type of the problem ?

thank you.
 
T

Thomas Tutone

I try to run following code in C++.NET ASP.NET project.

I'm not really familiar with what C++.NET is and how it differs from
ordinary C++. What you want to do is compile your program as a C++
program - leave the .NET stuff out.

The code is:
FolderItem.cpp
============

#include "stdafx.h"

Try deleting the above line entirely and rebuilding the program. Does
that fix the problem?
#include "FolderItem.h"

FolderItem::FolderItem(int i){ }
FolderItem::~FolderItem(){ }

FolderItem.h
==========

#ifndef EA_06B8EBB7_4E18_4f42_9F1E_3B0DF280308D__INCLUDED_
#define EA_06B8EBB7_4E18_4f42_9F1E_3B0DF280308D__INCLUDED_

class FolderItem{

public:
FolderItem(int i);
virtual ~FolderItem();
};
#endif


I try to run this code and get following errors:

ContentManager error LNK2001: unresolved external symbol "void __cdecl
operator delete(void *)" (??3@$$FYAXPAX@Z)
ContentManager error LNK2001: unresolved external symbol "void
__stdcall `eh vector destructor iterator'(void *,unsigned int,int,void
(__thiscall*)(void *))" (??_M@$$FYGXPAXIHP6EX0@Z@Z)
ContentManager fatal error LNK1120: 2 unresolved externals

If I put constructor / destructor inside header file, compilation
successes.
Is somebody know the type of the problem ?

If the above suggestion doesn't work, try building the following, in a
single .cpp file without any headers:

class FolderItem{
public:
FolderItem(int i);
virtual ~FolderItem();
};

FolderItem::FolderItem(int) { }
FolderItem::~FolderItem() { }

int main()
{
FolderItem f(0);
}

If that works, there appears to be some problem with how you've set up
your project - there is no C++ problem with your code. But if the .NET
stuff is the problem, you'll probably get better help on a Microsoft
newsgroup.

Best regards,

Tom
 
S

sna19

Thomas Tutone כתב:
I'm not really familiar with what C++.NET is and how it differs from
ordinary C++. What you want to do is compile your program as a C++
program - leave the .NET stuff out.

The code is:

Try deleting the above line entirely and rebuilding the program. Does
that fix the problem?


If the above suggestion doesn't work, try building the following, in a
single .cpp file without any headers:

class FolderItem{
public:
FolderItem(int i);
virtual ~FolderItem();
};

FolderItem::FolderItem(int) { }
FolderItem::~FolderItem() { }

int main()
{
FolderItem f(0);
}

If that works, there appears to be some problem with how you've set up
your project - there is no C++ problem with your code. But if the .NET
stuff is the problem, you'll probably get better help on a Microsoft
newsgroup.

Best regards,

Tom

Thank you, I will try to post this quetion in Microsoft group.
 

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

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top