LNK 2001 error

LNK 2001 error

I see that a lot of people have posted questions about getting LNK2001 errors, but I still haven't been able to fix my problem.

I am relatively new to CVS, so bear with me. I have a project with a main program and several subroutines and includes. I could compile, link, and execute this program with no problems. Then I had to change some of the subroutines. Now, everything compiles with no errors, but in the liking stage I get several LNK2001 errors:

ReadWind.obj : error LNK2001: unresolved external symbol _READZIP@20
Readzip.obj : error LNK2001: unresolved external symbol _GETDATA@4
Readzip.obj : error LNK2001: unresolved external symbol _WRITEDATA@16
Debug/ReadWind.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.

Where ReadWind is the main program, Readzip is a subroutine called my ReadWind, and GetData and WriteData are subroutines called by Readzip.

I'm stuck, can anybody help?


5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

your code simply references to something that linker can't find and raises error. As the description in CVF docs reads there are two reasons of that: (1) what the code asks doesn't exists and (2) you're using mixed versions of the libraries (maybe the mod files are mismatched).

The place to look at is, definitely, the ReadZip routine. Linker informs you that there is something wrong with GetData routine (on x86 after @the number of bytes (in decimal) is given required for the argument list).

Maybe you call that routine (ReadZip) from ReadWind with different number of arguments (I mean that declaration within ReadZip is different than that what you call from ReadWind). Look at variables of 4, 16, and 20 bytes). If the problem persists I'll try to think about something else.


The size of the variable itself is not reflected in the @n. The "n" is four times the number of arguments. This number may be larger than what you see in your source code because CHARACTER arguments count as two (an address and length are passed), and some functions which return large-typed values (character, complex, derived type, etc.) can add a hidden argument (or two) for the return value.

The most common reason for this error is a mismatch in argument lists between caller and called routine, such as passing a character value to a routine that expects an integer.


Retired 12/31/2016

I have looked at the declarations, and they match up correctly. I am truly stumped.

Ooops, I guess I spoke too soon. I did have a mismatch. I guess that is what I get for naming my variables too similarly. Thanks for all of your help....

Leave a Comment

Please sign in to add a comment. Not a member? Join today