Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Fortran code executes from the command line, fails in MSVS2005

avinashs
New Contributor I
713 Views

My Fortran codes that worked perfectly well in CVF were experiencing several unexpected errors in IVF10.0.24 with MSVS2005. One such error was the body of the do-loop "do i=j,n" executing even when j>n causing array elements greater than n being accessed in the body of the loop. Another error was several LNK2019 errors. Based on several helpful suggestions by Steve Lionel and others, I tried to reproduce the error with a simple code but could not. So as a test, I compiled and linked the same source files from the command line using a batch file. The only compiler option used was /nologo. To my surprise, the codes work just fine from the command line with no errors. The same codes do not even compile with Visual Studio. For AspenPlus chemical engineering software, which is built with IVF, again there seems to be no problem from the command line. Is this a known problem that can be resolved? Clearly I have now isolated it to the VS environment and not Intel Fortran itself. The compiler options in MSVS are /nologo /Od /iface:cvf /module:"Debug\\" /object:"Debug\\" /traceback /check:bounds /libs:static /threads /dbglibs /c From the command line, all I am doing (simplified example) is ifort /c /nologo myfile1.f ifort /c /nologo myfile2.f ifort -o myprog.exe *.obj I will add that all my source files do not use any advanced features beyond Fortran 90. Thanks in advance for your help.

0 Kudos
2 Replies
Steven_L_Intel1
Employee
713 Views

You'll need to provide us some more information.  Attach a buildlog.htm from the failed build. I will note that the default on the command line is to optimize and to omit all run-time checks. In VS, this is different depending on debug vs. release. Also, the linking environment can be different depending on your settings.

0 Kudos
mecej4
Honored Contributor III
713 Views
Clearly I have now isolated it to the VS environment and not Intel Fortran itself.
I think that you attribute more powers to the IDE than it actually is endowed with. The default options can, indeed, be set up differently in the IDE and in the command window. Among these, the /iface:cvf option that you listed is probably the most significant. Why do you have that option? Do you know the consequences of using that option? That difference, by itself, can make the difference between build failure or success. Do you have libraries that you must link to in order to build your application, and do you know that they must be called with /iface:cvf?

0 Kudos
Reply