• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

VC++ :LINK ERRORS

Carmen

Member
I'm adding two 'c' files (netshape.c and netshape.h) to
a Win32 Console application project in VC++,
when I complied the project, it has some linking errors:

netshape.obj : error LNK2001: unresolved external symbol _dbRead

I have already included all the necessary files in the projects setting and options.

Anyone knows where is the problem?
thanks for your help

Carmen
 
As I understand it from my use of C so far, the .h file is a header file and the .c is what would be compiled as an object to later be linked. So, in the netshape.c it should read:

#include <stdio.h>
#include &quot;netshape.h&quot;


as the preprocessor directives as well as anyother libraries or headers needed.

Then the netshape.c should be compiled as an object and the netshape.h needs no compiling or anything done to it.

I've only used IBM cc on AIX (and some gcc) for about a year, and this is coming from my experience only with linking objects and whatnot.

One question is the _dbRead a global variable in another file?
 
If you're using precompiled headers (i.e. you have stdafx.h and stdafx.cpp in your project), you'll need to make sure that the CPP files that you include in your project also uses the precompiled header.


🙂atwl
 
Actually i have two header files, netshape.h and nettopo.h,
in the code, netshape.c include nettopo.h
and nettopo.h include netshape.h
I'm not using precompiled headers(no stdafx.h and stdafx.cpp in the project)
I don't know what actually _dbRead is, probably varibles in the included library.
Thanks for instructions.
 


<< I don't know what actually _dbRead is, probably varibles in the included library.
>>



if you were linking in the library containing definition of _dbRead, than the symol would be resolved correctly at link time and the project would compile. Once you find out which library defines _dbRead go to Project->Settings->Link and add it to the object/library modules ( these are the static libs or object files your project links in with to resolve all unresolved references )
 
Back
Top