LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-15-2017, 01:27 PM   #1
amini29
LQ Newbie
 
Registered: Sep 2016
Posts: 8

Rep: Reputation: Disabled
Lightbulb Fortran compile error


I had been using my code(fortran 90) on linux openSuse, and it was working perfectly. Yet, now that I have switched to ubuntu and I have installed gfortran, it gives me error as sollows:

make

--- Compiling Fortran-90 source file [analysis.f90]
f95 -O3 -c analysis.f90
analysis.f90:18:4:

data vk /1,1,1, -1,1,1, 1,-1,1, 1,1,-1, -1,-1,-1, 1,-1,-1, -1,1,-1, -1,-1,1/
1
Error: DATA statement at (1) has more variables than values
makefile:21: recipe for target 'analysis.o' failed
make: *** [analysis.o] Error 1


I really appreciate if someone could help me with this problem. Thanks a lot.
 
Old 02-15-2017, 01:47 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Hi. For future reference it is best to include enough code in support of your question. And then also place code as well as things like command line outputs in within [code][/code] tags to maintain the spacing and formatting and also make it easier for readers of your questions.

The error report seems to echo the line in your source it has a problem with.

As with all syntax, you should look at that line, see if it matches correct FORTRAN syntax.

I feel you should check the space between "data" and "vk" and determine what it is and what it should be, whether it is an actual SPACE versus TAB.

This may be a newly edited line where the editor on your new system acts differently when you do certain keystrokes.

I'll move this to the Programming forum where I feel you'll get better assistance from readers. (Also renamed the question since "I" is not really helpful for people to see what the nature of your problem is.)

Last edited by rtmistler; 02-15-2017 at 01:53 PM. Reason: Clarified and reorganized the post better
 
1 members found this post helpful.
Old 02-16-2017, 05:48 AM   #3
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
It depends on the definition of variable 'vk'

Code:
dimension vk(24)  -- okay
dimension vk(3,8) -- okay
dimension vk(25)  -- bad: not enough value for 25 elemenets
dimension vk(5,5) -- bad: not enough value for 25 elemenets
 
Old 02-16-2017, 04:09 PM   #4
amini29
LQ Newbie
 
Registered: Sep 2016
Posts: 8

Original Poster
Rep: Reputation: Disabled
My problem got resolved, thank you so much.
 
Old 02-16-2017, 04:24 PM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by amini29 View Post
My problem got resolved, thank you so much.
Hi,

Glad you did resolve it.

Two things which will help future persons who experience similar issues are:
  1. If you can mark the thread as solved, which is in the Tread Tools menu which is part of the form
  2. If you can also provide some statements as to what solved the problem that will be helpful for other future seekers of solutions:
    1. It could have been the definition of the variable
    2. It could have been the interpretation of white spaces
    3. It could have been an entirely different thing which resolved this, and this would be helpful for people to know
Best Regards!
 
3 members found this post helpful.
Old 02-17-2017, 08:22 AM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
Yes: please take the time to "write for the future." Your post will be seen for years to come. Flag it as [SOLVED] and write a short "closing comment" that is intended to be beneficial to the next by giving him or her the that solved the same problem for you.

In particular, you imply that the same Fortran-90 source code was acceptable to Intel's compiler but not to Gnu's. That's very interesting. And, that's what we'd like to know more about from you in your closing-comments to this thread. (Anyone could be "stuck, and stuck for a very long time" by a subtle difference between two compilers.)

Last edited by sundialsvcs; 02-17-2017 at 08:23 AM.
 
2 members found this post helpful.
Old 03-02-2017, 07:22 AM   #7
amini29
LQ Newbie
 
Registered: Sep 2016
Posts: 8

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by amini29 View Post
My problem got resolved, thank you so much.
My data had only 8 entries, whereas, I had double precision:: vk(3,10),vk1(3,10),vkr,ar, ai,theta, when I changed it to
double precision:: vk(3,8),vk1(3,8),vkr,ar, ai,theta, it worked perfectly.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fortran error trying to compile an oceanographic model (COHERENS) harryvu Programming 4 03-04-2014 01:12 PM
Compile Error,..MPI for Fortran ArthurHuang Linux - Software 7 09-10-2007 11:16 AM
compile old fortran code in linux v2010 Linux - Software 2 12-13-2005 04:32 PM
how to compile fortran library and wrap it in C/C++ elvislu Programming 1 05-18-2005 01:19 AM
why doesn't my fortran program compile?? himan Programming 1 04-11-2004 10:43 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration