Mick
Mick

Reputation: 7947

unresolved external mystery

My linker is reporting an error as follows:

unresolved external symbol "unsigned char __fastcall BD_CLC(int,int)"...

But I maintain that all references to this function, as well as the definition of the function are of the form:

__forceinline UBYTE BD_CLC(int swap,int elem);

I even did a compilation with "Generate preprocessed file" set and went through the output. In every file where BD_CLC was used, the function was declared as

__forceinline UBYTE BD_CLC(int swap,int elem);

and of course the actual function definition was declared as

__forceinline UBYTE BD_CLC(int swap,int elem) { ... }

Any ideas?

Upvotes: 2

Views: 1291

Answers (3)

moonshadow
moonshadow

Reputation: 89115

Since you've declared the function __forceinline, you need to make sure the definition - not just the declaration - is visible everywhere the function is called.

Upvotes: 4

RED SOFT ADAIR
RED SOFT ADAIR

Reputation: 12228

I would try to remove the __forceinline attribute.

Upvotes: 0

Neil Anderson
Neil Anderson

Reputation: 1375

I think you may have to turn off the /GR "Calling Convention" compiler option. Perhaps the __fastcall is causing the Linker error.

/Gr specifies the __fastcall calling convention for all functions except C++ member sfunctions and functions marked __cdecl or __stdcall. All __fastcall functions must have prototypes.

Upvotes: 1

Related Questions