Linking error in VC++ .NET 2003

G

Guest

My copy of VS .NET is Microsoft Development Environment 2003, Version 7.1.3088
Microsoft .NET Framework 1.1, Version 1.1.4322

I have a project (C++ Class Library) I originally wrote in VS .NET 2002. It worked then, and when I convert it to VS .NET 2003 and recompile, it works now.

The problem is creating new projects in VS .NET 2003.

If you have my version, try this:

Create a blank solution (I called it "Test").
Add a new C++ project (Class Library (.NET)); I called mine "LinkFault".

Here is LinkFault.h:
==========================================
// LinkFault.h

#pragma once

using namespace System;

namespace LinkFault
{
public __gc class Class1
{
static double foo( const double x );
};
}
==========================================
Here is LinkFault.cpp:
==========================================
// This is the main DLL file.
#include "StdAfx.h"

//#using <mscorlib.dll>
//using namespace System;

#include "LinkFault.h"

#include <cfloat>
#include <cmath>

double LinkFault::Class1::foo( const double x )
{
// LinkFault error LNK2001: unresolved external symbol "int __cdecl _finite(double)" (?_finite@@$$J0YAHN@Z)
if ( _finite( x ) ) {
// do something
}
// LinkFault error LNK2001: unresolved external symbol "int __cdecl _fpclass(double)" (?_fpclass@@$$J0YAHN@Z)
else if ( _fpclass( x ) == _FPCLASS_PINF ) {
// do something else
}
else if ( _fpclass( x ) == _FPCLASS_NINF ) {
// do something else
}

// LinkFault error LNK2001: unresolved external symbol "double __cdecl sqrt(double)" (?sqrt@@$$J0YANN@Z)
return sqrt( x );
}
==========================================
I have added comments indicating the kind of errors I get.

When I change from Debug mode to Release mode the "sqrt" link error disappears, but the others persist.

I am at my wits' end!
 
G

Guest

Add "\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib\msvcrt.lib" to the Property Pages--> Linker-->Command Line additional options

Why isn't that the default?
 

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