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

Problem linking fortran files

vidhya_s_
Beginner
2,753 Views

Hello everyone,

I  am using intel fortran compiler XE 2013 SP1. I have a set of fortran files while needs to be compiled and get output as .exe. I tried running this on command prompt from Start>All programs>Intel parallel studio XE 2013>Command Prompt> Parallel studio XE with Intel compilers> IA-32 Visual studio 2013 mode. The set of fortran files i need to compiler are in C:\Users\Dosuments folder. When i try to compile and link usinf 'ifort' command, the command creates object files but fails to link showing 'fatal error LNK1104: cannot open file C:\Users\Amanda\lnk(430A554-382D-419E-A489-499AB3D95F897.tmp). A copy of what i have done is attached along with it. Please help me with the problem.

0 Kudos
1 Solution
Steven_L_Intel1
Employee
2,715 Views

Create a folder C:\Temp

In the Windows start menu or search box, search for "environment" (wothout the quotes). When you see an entry "Edit environment variables for your account", select that.

You will see two boxes, the top box has a list of "User variables for <your account name>. If TEMP is listed there, double-click on it to bring up the edit box. Change the Variable value to "C:\Temp" (again, no quotes).  Click OK and then OK again.

Now open a new Fortran command prompt window and try again.

View solution in original post

0 Kudos
26 Replies
Lorri_M_Intel
Employee
2,168 Views

It looks like there is a problem with the TEMP environment variable in that window.   What do you see with

echo %TEMP%

in that window?  Does the resulting directory exist?

Also, it looks like you've got a problem with one of your command line options.   I don't think that could be causing confusion at link time, but re-try without using that switch.

           --Lorri

0 Kudos
vidhya_s_
Beginner
2,168 Views

Hi

Thanks for your reply. The resulting directorydoes exist. I have no idea how to solve as i am not computer student and i need to do this for my project in biomechanics.Any help would be highly apprecited

0 Kudos
Lorri_M_Intel
Employee
2,168 Views

Try this please.

Create this simple program:

        program main
        print *, "Hello world!"
        end

Can you build it OK in your command window using this command:

       ifort myprogram.f90

If that works, please post your full command line that is not working so I can take a look and see if something is amiss.

                thanks --

 

 

0 Kudos
vidhya_s_
Beginner
2,168 Views

hi

I typed the program in just notepad and saved as hello.f90. i get the same error  which i have attached below.

0 Kudos
Steven_L_Intel1
Employee
2,716 Views

Create a folder C:\Temp

In the Windows start menu or search box, search for "environment" (wothout the quotes). When you see an entry "Edit environment variables for your account", select that.

You will see two boxes, the top box has a list of "User variables for <your account name>. If TEMP is listed there, double-click on it to bring up the edit box. Change the Variable value to "C:\Temp" (again, no quotes).  Click OK and then OK again.

Now open a new Fortran command prompt window and try again.

0 Kudos
vidhya_s_
Beginner
2,168 Views

hi steve

thank you so much. It worked, there was no problem in linking and created an exe file, but  when i try to run the exe file it shows error" end of file during read,unit 1 "C:\users\documents\amanda\Matlab\AdjArraj.dat" Adjarray.dat is one of the input that one of the linked fortran files rrequire. All the files are in same directory. Please help me with te issue. other inpt files required by fortran files are also in same directory. plese find the attchment.

 

 

0 Kudos
mecej4
Honored Contributor III
2,168 Views

The possible reasons for end-of-file on read are numerous, and it it up to you, the programmer/user, to coordinate the contents of the file and the READ statements connected to that file.

Some questions to ponder over: Is the data file a text file? What does it contain? Do you know in advance how many records will be read by your program? Does the file have fewer records than that? Are there errors in the input file contents? Are there errors in the READ statements?

Fortran provides you with a number of tools to control I/O. You can find the position within the file, and you can set the position if needed. You can test for end-of-file and write program code to take appropriate action when that condition occurs. If your program has a large number of READ statements in it, re-compiling  withe the /traceback option will help you to pinpoint (by line number) the specific READ statement that ran into the end-of-file condition.

 

0 Kudos
vidhya_s_
Beginner
2,168 Views

Hi

Thanks for your reply. The input file is not a text file it just has some numbers. There are no possibilities for errors in input file "AdjArry.dat". I don understand what you mean by records. sorry i am not familiar with programming. I have attached Adjarray.dat file and the piece of ma program from fortran file that takes Adjarray input. Please have a look at it and help me to solve it.

0 Kudos
DavidWhite
Valued Contributor II
2,168 Views

Firstly, your program will not get past the first read statement in the DO loop, because of the STOP statement.

Without the STOP statement, your program will read in N1 sets (records) of indmax+1 numbers.

Your data file tells us that indmax is 14, so the read statements will read in 15 items each, which your dataset has.

The dataset has 3 rows of data, but we are not told what value N1 is.

If N1 is 3, then all is good.  If N1 is greater than 3, then you will run out of data and will get an error message when you try to read the next record.

Regards,

David

 

0 Kudos
vidhya_s_
Beginner
2,168 Views

Hi

Thanks for your reply. I tried again changing N1 value to 3 and removed stop after first read statement. It now shows another error "Program Exception- Access violation". I have attached a copy of the error and the  edited program. please have a look and kindly help me out.

Thank you

Vidhya

 

0 Kudos
Anthony_Richards
New Contributor I
2,168 Views

It is no good providing part of the Fortran program as the error may be occurring because of a fault in a part you do not display. Compile a debug version, put in some break points and use the 'Start with debugging' option to run the debug configuration. As you step through the program, use the break-points as the chance to examine ('watch')  variables to confirm they contain values that you expect. Continue running after each break-point. When the program reaches the problem line of code, it will automatically break and tell you where and what is the problem. Then we might get somewhere towards finding and correcting the first program error. Without doubt, there will be more. Bug-finding is a continuing process.

 

0 Kudos
mecej4
Honored Contributor III
2,168 Views

Please do not post program text and output encoded as image files (.PNG). If someone wishes to run the compiler on your code, it would become necessary to type the program text again, and few may be willing to do so. Use the CODE button (the last but one button on the toolbar at the top of the window in which you compose a reply), or simply copy/paste the code along with your message.

As Anthony Richards wrote, simply reporting error messages will not help you solve your problems. Most error messages are not of the type for which the cure can be given without even seeing the program code and data. 

The Intel compiler comes with extensive documentation, and that should among the resources you use for understanding the error messages and the rules of the language..

0 Kudos
vidhya_s_
Beginner
2,168 Views

Hi

Thanks again for you replies. I am sorry my knowledge about programming is nearly zero and the code i am using is written by someone who i cant even contact for doubts. i have attached the whole program and the imputs for it. Please have a look.  I wasn't able to attach input file so i have just copied it below. Thank you

    14
     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0

 

Regards

Vidhya

0 Kudos
mecej4
Honored Contributor III
2,168 Views

You can zip together any number of files of various types, and attach the zip file.

You have provided only one data file. Your program opens and reads a number of other files, which you have not provided. The portion of the code that opens and reads file AdjArray.dat functions correctly. This can be tested easily by placing a GOTO statement after Line-40 to the OPEN statement that I just mentioned.

Therefore, if you encountered an access violation, it occurred in a portion of the code that I am not able to run, since the necessary data files are missing.

0 Kudos
vidhya_s_
Beginner
2,168 Views

hi Please find attached the folder for all the input files and programs. Kindly help me. thanks in advance

Regards

Vidhya

0 Kudos
mecej4
Honored Contributor III
2,168 Views

The source code for subroutine surfacematch() is missing. If the call to the subroutine is removed from the source code, the program can be compiled and runs to completion with no errors.

Please recompile the program with the /traceback option, run again, and report the line numbers where the access violation occurs. Also, provide the missing source code if possible.

0 Kudos
vidhya_s_
Beginner
2,168 Views

hi

thanks for your reply. I am sorry i forgot to attach "surfacematch.params" file. please find the attachment. The format wasn't supported so i have put it in zip folder.  Thanks

Regards

Vidhya

 

0 Kudos
mecej4
Honored Contributor III
2,168 Views

No, that is not the file needed. The data in that file, surfacematch.params, is already in the program text inside test.f90. What is needed is the Fortran source code of Subroutine SurfaceMatch(), which is called from Line-154 of test.f90.

0 Kudos
vidhya_s_
Beginner
2,168 Views

hi

Sorry i was confused. I have attached the fortran file for that surfacematch subroutine. Please have a look. Thank you

Regards

Vidhya

 

0 Kudos
mecej4
Honored Contributor III
1,981 Views

The source code is still incomplete. The new file that you just posted uses a module ("kdtree2_module") that has not been provided.

0 Kudos
Reply