Problem linking fortran files

Problem linking fortran files

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.

AttachmentSize
Downloadimage/png problem.png56.41 KB
27 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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

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

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

 

 

hi

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

Attachments: 

AttachmentSize
Downloadimage/png error_2.png36.83 KB
Best Reply

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.

Retired 12/31/2016

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.

 

 

Attachments: 

AttachmentSize
Downloadimage/png error1.png48.83 KB

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.

 

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.

Attachments: 

AttachmentSize
Downloadimage/png program.png11.62 KB
Downloadimage/png input_0.png25.14 KB

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

 

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

 

Attachments: 

AttachmentSize
Downloadimage/png error234.png32.54 KB
Downloadimage/png pro.png10.62 KB

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.

 

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..

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

Attachments: 

AttachmentSize
Downloadapplication/octet-stream Test_0.f907.06 KB

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.

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

Regards

Vidhya

Attachments: 

AttachmentSize
Downloadapplication/rar files.rar822.14 KB

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.

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

 

Attachments: 

AttachmentSize
Downloadapplication/rar SurfaceMatch.rar448 bytes

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.

hi

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

Regards

Vidhya

 

Attachments: 

AttachmentSize
Downloadapplication/rar ElasticMatching.rar3.22 KB

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

Hi i am really sorry. i will give you entire fortran file. Please try to help me solve this. Thank you

Regards

Vidhya

Attachments: 

AttachmentSize
Downloadapplication/rar vidhya.rar26 KB

I can reproduce the access error that you mentioned in #11. However, that is not interesting because it is the outcome of array bounds being overrun earlier. To see this for yourself, recompile with the /traceback /check options and run.

You will see that on line 144 of file ElasticMatching.f90 you try to refer to w(:,:) with a second index value (=19729) that exceeds the upper bound of the second dimension of w, which was allocated with (3,19728).

You will have to go through the code to make sure that the arrays are allocated with sufficient extents to cover their intended usage.

hi

Thanks for the reply. i had a look t it. i understand what the problem is but how do i change it. can i try w(0) - w(1) from line 144 then w(2) -w(3) in the later line. do you think it will work. i tried by changing it was showing me access violation error again. kindly help me. Thanks

Regards

Vidhya

Quote:

vidhya s. wrote:
i understand what the problem is but how do i change it. can i try w(0) - w(1) from line 144 then w(2) -w(3) in the later line. do you think it will work. i tried by changing it was showing me access violation error again. kindly help me.

Hi

I tried by replacing the line 144 in ElasticMatching w(3,N1) with w(3,N1+1). i got the iteration number then later it displayed windows stopped working. The Picture of which i have attached below. Kindly have a look. Thank you

Regards

Vidhya

 

Attachments: 

AttachmentSize
Downloadimage/png errorer1.png77.87 KB

I deplore making arbitrary changes to code with the hope that these changes will cure serious problems that have not yet been understood.

Sorry, I have nothing more to contribute to this thread.

Leave a Comment

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