Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,327 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,824 people online right now. Registration is fast and FREE... Join Now!




error LNK2001: unresolved external symbol _muscleTendonLength

 
Reply to this topicStart new topic

error LNK2001: unresolved external symbol _muscleTendonLength

JFLetuBiomed
11 Apr, 2008 - 12:49 AM
Post #1

New D.I.C Head
*

Joined: 11 Apr, 2008
Posts: 1

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:
QUOTE

Linking...
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):
CODE

extern dpMuscleTendonLengthStruct* muscleTendonLength;

      ...

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

      ...

      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):

CODE

...

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, source written in C obviously).
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 you may need to pull back the throttle on lingo and explanations...

Your help is greatly appreciated.
User is offlineProfile CardPM
+Quote Post

jeronimo0d0a
RE: Error LNK2001: Unresolved External Symbol _muscleTendonLength
11 Apr, 2008 - 06:54 AM
Post #2

D.I.C Head
**

Joined: 3 Mar, 2008
Posts: 141


My Contributions
In the .c file muscleTendonLength is listed as extern; is it actually declared in the .h file? The struct is but in the snippet there's no instance of mtLength. If there are other structs in the .h that appear to work, you can try following them to make sure you have it all declared right. Also be aware of two things, link errors can be hard to find, don't feel bad. 2. There may be other unresolved externals, the linker just gives up on the first one. So if this code looks like all the others you may have to fix them after you do this one.
Good luck and don't give up.
Hope this helps.
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: Error LNK2001: Unresolved External Symbol _muscleTendonLength
11 Apr, 2008 - 03:52 PM
Post #3

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,858



Thanked: 49 times
Dream Kudos: 550
My Contributions
the error means that you are trying to use something that the linker can't find. Usually this is because you forgot to define something you declared (and used), or you did not tell the linker where to find the object file, or library that contains the "unresolved external".

If you are using external libraries or object files make sure your IDE knows to include the libraries and/or object files.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/2/08 07:47AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month