-
May 26th, 2011, 06:54 AM
#1
Linker error while connecting static library with DLL
I have a static library in which class with log4net is defined.something like this -
public ref class CustomLog
{
public:
static log4net::ILog^ m_logger;
log4net::ILog^ SetLogger();
};
This static library is then used to connect to another C++ DLL - I have added header file used for this log class in C++ DLL also added static library reference in additional dependency.WHen I ma trying to compile this DLL getting following linking error -
error LNK2020: unresolved token (06000003) CustomLog::SetLogger
Please let me know how to resolve this issue.
-
May 26th, 2011, 07:10 AM
#2
Re: Linker error while connecting static library with DLL
Hmmm... CustomLog is a class you wrote yourself? Looks like you simply declared CustomLog::SetLogger() but didn't define it. So, not actually a problem with the 3rd-party library in this case.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
-
May 26th, 2011, 07:37 AM
#3
Re: Linker error while connecting static library with DLL
I had defination as well.This static library builds succesfully,but when trying build another C++ DLL throws linker error.Here is defination of SetLogger().
log4net::ILog^ CustomLog::SetLogger()
{
String^ str = "CustomLoger";
CustomLog::m_logger = log4net::LogManager::GetLogger(str);
return CustomLog::m_logger;
}
Any thoughts??
-
May 26th, 2011, 07:50 AM
#4
Re: Linker error while connecting static library with DLL
Originally Posted by forstudy3
Any thoughts??
Not really sophisticated ones at the moment, I must admit.
Are you sure the source file containing this definition actually gets compiled and takes part in the linking process (IOW maybe incorrect project settÃ*ngs)? Does that module define other functions that are used from other modules about which the linked does not complain?
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
-
May 26th, 2011, 07:56 AM
#5
Re: Linker error while connecting static library with DLL
Yes ,it has many other modules and methods.Linker only complains about this class.
-
May 26th, 2011, 10:16 AM
#6
Re: Linker error while connecting static library with DLL
Well, I'm a bit out of ideas now so I did an MSDN search hoping to find some inspiration. (Did you try this too?)
Just a shot in the dark: Could it be something really silly like forgetting to qualify the class name when defining the function like in this thread on MSDN: http://social.msdn.microsoft.com/For...e-33caeff5aaad? (To mitigate the embarrassment incurred by this a bit: This happens to me too from time to time... )
Aside from that I can only recommend an MSDN search (and as plan B a Google search) for now. Since in my tests to reproduce the problem I always got a 06000001 as part of the error message instead of your 06000003, I tried to restrict the search by specifying the number you got as an additional search criterion. I don't think that gains much though. It seems this number is just an internal number used by the linker to identify the token, so it's arbitrary, not further specifying the cause of the error.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|