Linking errors. - VC++ - Unresolved external Symbol

M

mp

Hi,

I have a Static library application in vc++ which generates
Parser.lib.

I have written a exe application in vc++ that links to Parser.lib.
This does some processing. (This project generates processor.exe) I
have given the path to Parser.lib in the additional library resources
in the linker settings and included a header file Parser.h. This
works perfectly.

But the actual requirement is that I should have processor.lib instead
of processor.exe so that I can call it from another project. So I
created a Static library and followed the same steps (including the
header and giving the path to the Parser.lib) THis generated
Processor.lib

NOW THE PROBLEM IS WHEN I link PROCESSOR.LIB from a exe project
(caller). I gave the include files and path to Processor.lib, but I
get the error:

unresolved external symbol "int __cdecl check(void)

(check() is a function in the Static Library Processor.lib )

Why does this happen?

It works when I have a Parser.lib and Processor.exe

But when I call Parser.lib <- Processor.lib <- caller (exe project) it
fails. Why is that ?


PLEASE HELP!
 
A

Ali R.

is your function declared as __declspec(dllexport). And also when you are
reading the h file in your exe project the dllexport thing needs not be
there. Anyway I do this when I am creating a library

#if !defined( _AFXDLL )
#define DllExport

#else

#define DllExport __declspec( dllexport)

#endif // !defined( _AFXDLL ) || defined( _XT_STATICLINK )

class DllExport MyClass

{
};


or

void DllExport MyFunc();

Ali R.
 
M

mp

Hi,

The problem was that of calling a C program from a C++ program. I
dint notice that I missed this detail.

After I added this to the caller project it works fine.

#include<stdio.h>
#ifdef __cplusplus /* identifies C++ */
extern "C" { // tell the C++ compiler that you have C decls

#include "C:\vlib\parser.h"
}
#endif



Thanks for the response.

MP
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top