Linking Error 
Author Message
 Linking Error

So, Sanj, did you add 'Agrep.c' to the project in question?
That's the way to get the compiler to produce an .obj, and the linker to
link that with the rest of your object files.

Hope that helps,

--
Kim Gr?sman, Visual C++ MVP
http://www.*-*-*.com/


Quote:
> Hi,

> I've come across a linking error which I havent been able
> to resolve.  The error occurs when the compiler is Linking
> and comes up with the following message:

> Linking...
> ParseOCR.obj : error LNK2001: unresolved external
> symbol "int __cdecl fileagrep(int,void *,int,void *)" (?

> ..\..\..\bin/ParseXDocD.exe : fatal error LNK1120: 1
> unresolved externals
> Error executing link.exe.

> ParseXDocD.exe - 2 error(s), 0 warning(s)

> It is referring to a function 'fileagrep()' which I
> attempt to call in the Module 'ParseOCR.cpp', the actual
> function fileagrep() is a Module called 'Agrep.c' and the
> prototype of the function is in a header file which both
> files can see.

> I will appreciate any help to resolve this error.

> Thanks

> Sanj



Mon, 11 Jul 2005 20:50:51 GMT  
 Linking Error

It sounds like you are trying to link C code to C++.

To make that work you have to tell the C++ compiler
to make the functions accessible to C. You do that
by prefixing the function declaration and definition
with:
extern "C"

Otherwise you get a 'decorated' name from the C++
compiler, the C compiler looks for an undecorated
name, and there's no match.

Alternately, convert Agrep.c to C++ - rename it to
Agrep.cpp and fix whatever compile problems this
causes.

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> Hi,

> I've come across a linking error which I havent been able
> to resolve.  The error occurs when the compiler is Linking
> and comes up with the following message:

> Linking...
> ParseOCR.obj : error LNK2001: unresolved external
> symbol "int __cdecl fileagrep(int,void *,int,void *)" (?

> ..\..\..\bin/ParseXDocD.exe : fatal error LNK1120: 1
> unresolved externals
> Error executing link.exe.

> ParseXDocD.exe - 2 error(s), 0 warning(s)

> It is referring to a function 'fileagrep()' which I
> attempt to call in the Module 'ParseOCR.cpp', the actual
> function fileagrep() is a Module called 'Agrep.c' and the
> prototype of the function is in a header file which both
> files can see.

> I will appreciate any help to resolve this error.

> Thanks

> Sanj



Tue, 12 Jul 2005 04:32:48 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Linking error when link for Codeview

2. VC 4.2 link error linking static libraries from VC 6.0

3. Link Errors in Static Link

4. Link errors during static link

5. LINK : error : Internal error during Pass1

6. LINK : error : Internal error during EmitMap

7. LINK : error : Internal error during SetupPhase

8. Link error: 'Internal error during ReadSymbolTable'

9. LINK : error : Internal error during EmitMap

10. Link Errors : error LNK2005 and LNK2004

11. LINK : error : Internal error during Pass1

12. LINK : error : Internal error during ReadSymbolTable

 

 
Powered by phpBB® Forum Software