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
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
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
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
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);
}
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);
}
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