Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Error LNK 2001

Ting_L_
Beginner
2,940 Views

Hi,

I was blocked by a problem when I try to program with Fortran in VS 2008 Pro. Even a simple test fortran program cannot be run:

Program test

print *, "hello"

end

Error as follows:

LIBCMTD.lib(close.obj): error LNK2001

LIBCMTD.lib(open.obj): error LNK2001

Who will be kindly provide solutions? Thanks in advance.

 

 

 

0 Kudos
11 Replies
mecej4
Honored Contributor III
2,940 Views

Is this a new problem with a system/installation that worked for similar purposes before today? What procedure did you follow when attempting to compile? Did you use Visual Studio or the command line environment? Which OS version?

If you used Visual Studio, please attach the build log file ("buildlog.htm").

0 Kudos
Ting_L_
Beginner
2,940 Views

Thanks for the feedback.

I compile Fortran in VS 2008 pro under Window 7, and this error occurred after I reinstalled VS. But never got this problem before. Then I tried to modify system variables but still not working.

You can find enclosed building.htm  

 

 

0 Kudos
mecej4
Honored Contributor III
2,940 Views

The problems are probably a result of your reinstalling Visual Studio. The simplest solution for you is to remove and then reinstall Intel Fortran over the new Visual Studio, so that the Fortran-VS integration can be set up properly. Before doing so, however, you may wish to consult a system administrator, if there is one for your system.

0 Kudos
Ting_L_
Beginner
2,940 Views

Hello Mecej;

I have tried to reinstall the VS and Intel Fortran, but still not working....The same error....

0 Kudos
Kevin_D_Intel
Employee
2,940 Views

Just capturing some notes of your components:

Windows 7 (32bit or 64bit?)
Intel Visual Fortran 11.1.072 (IA32 compiler)
Visual Studio 2008

You mentioned modifying system environment variables. Did you undo those changes before you reinstalled Visual Studio and the Intel Compiler?

Have you tried opening an Intel compiler initialized command-prompt window (something like: Start > All Programs > Intel(R) Software Development Tools > Intel(R) Fortran Compiler 11.1.072 > Fortran Build Environment for applications running on IA-32) and compiling the small program using the ifort command-line?

Something that might help resolve this, under the Intel compiler initialized command-prompt window, execute the command: set  > listing.txt and then attach the list.txt file to this forum thread.

0 Kudos
Ting_L_
Beginner
2,939 Views

Hello Kevin,

My win7 is 32bit.

I tried to undo changes but not working. And if I compile small program:

Program test

print *, "hello"

end

by ifort command-line via Fortran Build Environment for applications running on IA-32, there will be error #5149: illegal character in statement label field

.

Please find enclosed file listing.txt of the environment. Looking forward to your reply.

0 Kudos
Lorri_M_Intel
Employee
2,939 Views

it looks like the compiler thought your little program was in fixed-form.

Please try adding "-free" to the command line, or change the file extension to .f90.

              --Lorri

 

PS: I looked at your zip file ... what is "listing.exe"?  I didn't open that file because it looked like an executable.

0 Kudos
mecej4
Honored Contributor III
2,939 Views

The error message "illegal character in statement label field" is probably the result of your putting free-format Fortran code, such as that shown in #7, in a file with the .f suffix. The compiler expects files with the ".f" suffix to be in fixed format Fortran (statement in columns 7-72, labels in 1-5, etc.). Please rename your source file to have the ".f90" suffix and retry compiling in the IFort command window.

The zip file that you attached contains a file called "listing.exe", but the file contents are actually text. However, because ".exe" is normally used for executable files, and some of those may be malicious programs, some people and antivirus programs may quarantine/block/destroy the zip file.

0 Kudos
Ting_L_
Beginner
2,939 Views

Dear Lorri,

Sorry for the executable file since it's like virus.

You can find the environment list as attached.

Thanks for the suggestions, but there is error lnk 2001 and lnk 2019 when I change it into .f90. Now we return to my initial question about LNK 2001. I am really puzzled by this problem

Is there anything wrong with my environment? Thanks in advance.
 

0 Kudos
Lorri_M_Intel
Employee
2,939 Views

I do see something interesting, although I don't know how it happened.  The first value in your PATH environment variable appears to be missing a "\" between "072" and "lib".   Try fixing that, using Control Panel or the command line, and then try again.

That said, link errors 2001 and 2019 indicate undefined/missing variables.  I assume that for security reasons, you removed the actual variable names from your buildlog.  

However - without a few names, I can't help you figure out what might be missing. 

        Can you share a few of them?

                             --Lorri

 

0 Kudos
Ting_L_
Beginner
2,939 Views

Lorri Menard (Intel) wrote:

I do see something interesting, although I don't know how it happened.  The first value in your PATH environment variable appears to be missing a "\" between "072" and "lib".   Try fixing that, using Control Panel or the command line, and then try again.

That said, link errors 2001 and 2019 indicate undefined/missing variables.  I assume that for security reasons, you removed the actual variable names from your buildlog.  

However - without a few names, I can't help you figure out what might be missing. 

        Can you share a few of them?

                             --Lorri

 

I have updated the path, but failed to compile. No variable names were removed. The background is I want to integrate Intel Fortran with AVL Fire. But only specific version VS 2008 and IVF 2011.1 are allowed. And you mentioned some variables are missing, so that means there should be some variables?

Please find new environment list and buildlog.

0 Kudos
Reply