Re: Trouble linking library
From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 02/20/05
- Next message: Joseph M. Newcomer: "Re: How do I designate USB port's name in CreateFile's argument?"
- Previous message: Joseph M. Newcomer: "Re: How to capture the Scroll event in CListCtrl?"
- In reply to: Dennis Aries: "Trouble linking library"
- Next in thread: Dennis Aries: "Re: Trouble linking library"
- Reply: Dennis Aries: "Re: Trouble linking library"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 20 Feb 2005 00:07:39 -0500
Hmm. The last time I looked, LNK2001 was not an error message. There is an error message
that starts with this code, BUT IT HAS LOTS OF TEXT THAT FOLLOWS IT! If you want help, you
have to make a bug report that contains all the information you have available. For
example, what is the name of the symbol it cannot find?
You have not described what you mean by a console application. For example, is it a .c or
a .cpp source file? A console application could be either one, but you have not said
anything that gives us a context for analyzing the problem.
All you've given is a vague and fairly useless description of the problem.
Note: if the DLL was compiled as C source, it will have a function, for example,
int SomeFunction(int x);
but if you include the header file in C++, it will want to link to a function called
SomeFunction$67AIEGHQ@4
or some equally silly name. Had you included the text of the error message, instead of
something as completely useless as the error number, something might be inferred.
I have no idea why people will give compiler or linker error numbers without the
accompanying text; the text is the ONLY important part of the message. Instead, we always
get the least useful and least important part of the message in reports.
I suspect that your header file is missing the following declaration:
#ifdef __cplusplus
extern "C" {
#endif
.... function declarations here
#ifdef __cplusplus
}
#endif
If you do not have these in your header file, and the DLL was compiled for a C interface,
this would explain the error. But without any meaningful bug report, this is just a guess.
joe
On Fri, 18 Feb 2005 02:33:01 -0800, Dennis Aries <DennisAries@discussions.microsoft.com>
wrote:
>I have a third-party dll, together with the given header-file and lib-file.
>When I include /link the files in a console-application, everything works
>fine. When I try to do the same in an MFC-application, I get the
>LNK2001-error.
>
>In my projectbrowser, I can see the defined structures (from that
>header-file), but not the functions in that same file (which I would expect
>to see under globals).
>
>Any suggestions on how to solve this problem?
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
- Next message: Joseph M. Newcomer: "Re: How do I designate USB port's name in CreateFile's argument?"
- Previous message: Joseph M. Newcomer: "Re: How to capture the Scroll event in CListCtrl?"
- In reply to: Dennis Aries: "Trouble linking library"
- Next in thread: Dennis Aries: "Re: Trouble linking library"
- Reply: Dennis Aries: "Re: Trouble linking library"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|