Advertisement

the infamous UNRESOLVED EXTERNAL ERROR

Started by April 05, 2000 02:20 PM
0 comments, last by a2k 24 years, 7 months ago
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
------------------General Equation, this is Private Function reporting for duty, sir!a2k
''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

This topic is closed to new replies.

Advertisement