Archived

This topic is now archived and is closed to further replies.

a2k

the infamous UNRESOLVED EXTERNAL ERROR

Recommended Posts

hey, does anybody have a clue about what this REALLY means? like, what types of errors this is caused by and how to fix it? (vc++ 6.0) i know it''s a linker error, but i''ve always been a poor file organizer, so maybe somebody can tell me how to arrange these headers and source code to prevent this goddam error. a2k

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
''Unresolved external errors'' are caused by the fact that the linker can''t find certain functions/variables. This can be caused by a couple of things, though... Missing libraries are the most common, I think. Some more specific information is required to fix your case.

A good arrangement for header and source files is to put declarations of objects (extern object declarations, (inline) function declarations, class/struct declarations, variable declarations) in the header files, and actual definitions in the source files.

Example:
// --- test.h
typedef unsigned char uchar;
const uchar INLINE = 128;
extern uchar extVar;
int foo(uchar);
class A
{
public:
void bar();
void foo() { ... }
}

// --- test.cpp
#include <test.h>

extVar = ''a'';

void
A::bar()
{ ... }

int
foo(uchar t)
{ ... }
{ .. }

Erik

Share this post


Link to post
Share on other sites