I've got some fairly expansive code for musculoskeletal simulations that I'm altering. I've double and triple checked my code segments, but I've been banging my head against this particular error for some time. I'd appreciate any elucidation you kind fellows can pass my way. If any further code, etc would be helpful in the diagnosis, please just let me know.

First, here are the errors I encounter:

Creating library Debug/simulation.lib and object Debug/simulation.exp
gmc.obj : error LNK2001: unresolved external symbol _muscleTendonLength
..\simulation.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Here are some pertinent segments from the source code (gmc.c):

extern dpMuscleTendonLengthStruct* muscleTendonLength;


muscleTendonLength = (dpMuscleTendonLengthStruct*)malloc(sdm->num_muscles *


					muscleTendonLength[i].numMTLStructs = dataSetCount + 1;
					muscleTendonLength[i].muscleTL = (dpMTLStruct*)realloc(muscleTendonLength[i].muscleTL,muscleTendonLength[i].numMTLStructs*sizeof(dpMTLStruct));


etc, etc

and now the definition file for the external dependencies (structs.h):


typedef struct
   char name[50];
   int numMTLStructs;
   int calctorque;
   dpMTLStruct *muscleTL;
} dpMuscleTendonLengthStruct;


All of this is, of course, very truncated bits of code.

I'm using MS Visual C++ 6.0 to build (Win XP, WIN32).
From what I can tell, everything appears properly called and linked, but obviously something must be amiss, or is there some obscure buffer or sdk bug I need to get fixed?

Also, in your responses please remember that I am a Biomedical Engineer first and a coder second, or probably 3rd actually, and so pulling back the throttle on lingo and explanations would be greatly appreciated... :)

Your help is greatly appreciated.

The problem is that there probably is no definition of the variable muscleTendonLength anywhere (hence the linker really is unable to do its job).
and place the definition

dpMuscleTendonLengthStruct* muscleTendonLength;

somewhere suitable in your code. You may also want to initialize the definition of muscleTendonLength to e.g. NULL.

Didn't I do an inline definition of muscleTendonLength in the code segment I showed in my original post?

extern dpMuscleTendonLengthStruct* muscleTendonLength;

My apologies, you were absolutely correct.

This change removed my errors.

Thank you very much for your assistance.

This question has already been answered. Start a new discussion instead.