.

.
[1 byte] By [dotnetrob] at [2008-2-15]
# 1
.
dotnetrob at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 2
Thank you very much!
e-roo at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 3
Big SmileThank you, dotnetrob, you saved us hours of frustration!

Kind regards

christof

Christof.Mattes at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 4
Thanks dotnetrob,

We had the exact same problem and that fix worked perfectly!

- HeloiseD

HeloiseD at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 5
Thanks a million... I've been struggling with this for over a day !
AdarshSridhar at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 6

Thank you. Smile

DavidSmithfromMSU! at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 7
I was able to get rid of the link error by removing the /Zl option from the compiler options--I didn't have to add any libraries to the linker options (although that also worked in my case). I'm using the GA version of VS 2005.
zhangrusi at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 8

How do you change the options of the Linker? I am using Visual Studio .NET 2005. I am having similar linking problems, but dont know where to add the .lib files or how to change them or remove /ZI and where to remove it from. Any help would be greatly appreciated. Thanks

Regards,

Alexandrei

Alexandrei at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 9

Here's what you need to do from the IDE. Take Project Settings - Linker - Input, and set "Ignore all default libraries" to "No". You might also need to remove $(NoInherit) from "Additional dependencies". Now, you should be able to link your projects properly.

Alexandrei wrote:

How do you change the options of the Linker? I am using Visual Studio .NET 2005. I am having similar linking problems, but dont know where to add the .lib files or how to change them or remove /ZI and where to remove it from. Any help would be greatly appreciated. Thanks

Regards,

Alexandrei

NishantSivakumar at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 10

This is the error that I keep getting, I tried changing the setting and it turns out that in Linker -> Input, it appears that there are no options set within "Additional Dependencies". Also the "Ignore all default libraries" option was already set to "no".

This is the error:

MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function tmainCRTStartup

C:\Documents and Settings\Alexandrei\My Documents\Visual Studio 2005\Projects\linkingError\Debug\linkingError.exe : fatal error LNK1120: 1 unresolved externals

Not sure why this errors is being caused. All that i am trying to do is make a very simple class. And I get this error. This is only happens when I am trying to create a class, atleast from what I have noticed.

Again any help is greatly appreciated. Thanks

Regards,

Alexandrei

Alexandrei at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 11

Do you have a main function? You seem to be attempting to create a class library (thus no main method) but you are using an exe project setting.

Alexandrei wrote:

This is the error that I keep getting, I tried changing the setting and it turns out that in Linker -> Input, it appears that there are no options set within "Additional Dependencies". Also the "Ignore all default libraries" option was already set to "no".

This is the error:

MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function tmainCRTStartup

C:\Documents and Settings\Alexandrei\My Documents\Visual Studio 2005\Projects\linkingError\Debug\linkingError.exe : fatal error LNK1120: 1 unresolved externals

Not sure why this errors is being caused. All that i am trying to do is make a very simple class. And I get this error. This is only happens when I am trying to create a class, atleast from what I have noticed.

Again any help is greatly appreciated. Thanks

Regards,

Alexandrei

NishantSivakumar at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 12
I am trying to create a class, I have the class called Rational.cpp and the header called Rational.h.

I dont have any main functions in yet. Is that the problem?
Heres example of what I have so far.

#include "Rational.h"

Rational::Rational(void)

{

}

Rational::~Rational(void)

{

}

====================================================

#pragma once

class Rational

{

public:

Rational(void);

public:

~Rational(void);

}

Alexandrei at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 13

Okay, so you are attempting to create a library and not an executable. Also, you seem to be using native classes. What you need is a regular Win32 DLL project that exports symbols. You can generate one using the wizard, and it'll show you how to export a class out of it.

Alexandrei wrote:
I am trying to create a class, I have the class called Rational.cpp and the header called Rational.h.

I dont have any main functions in yet. Is that the problem?

Heres example of what I have so far.

#include "Rational.h"

Rational::Rational(void)
{
}
Rational::~Rational(void)
{
}

====================================================

#pragma once

class Rational
{
public:
Rational(void);
public:
~Rational(void);
}

NishantSivakumar at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 14
Thank you so much for the help, I tried writing it with an executable

and it compiled perfectly. Now that I know how to just create a library

I will do that next time and use Win32 DLL project.

Thank you so much Nishant. You saved me a lot of time and frustration!

I will make sure to email you if I ever encounter any problem like this.

Thanks for your time and patience,

Alexandrei

Alexandrei at 2007-9-8 > top of Msdn Tech,Visual C++,Visual C++ Language...