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

visual studio cannot debug because a debug target has not been set

concequence
Beginner
1,660 Views
Hi could anyone help me out with the above problem? I am new to visual studio and Intel visual Fortran. I have a sample program: 'compute_one.f90' with a data file and about 5 subroutines used by it. Now i created a static library from the "new project tab" and added all five subroutine Fortran f.90 files under 'subroutines folder'. I got confused on just where to list the main program file and data file. Do i include them in the 'subroutine folder' along with the other 5 subroutines used by the 'compute_one.f90' file? This is my confusion on where to deposit my main program file and subroutines to. In any case, i had them all in the same 'subroutine folder' under the same project created. I then build the project, it was successful and then compiled it. It appears to work fine (i hope, with no errors reported). The following output was generated:

After BUILD, i got this msg:
1>------ Rebuild All started: Project: staically, Configuration: Debug Win32 ------
1>Deleting intermediate files and output files for project 'staically', configuration 'Debug|Win32'.
1>Compiling with Intel Fortran Compiler 10.1.011 [IA-32]...
1>solve_band.f90
1>getname.f90
1>fmrmat.f90
1>contour.f90
1>main_int.f90
1>p41.f90
1>Creating library...
1>
1>Build log written to "file://C:Documents and SettingsedemMy DocumentsVisual Studio 2005ProjectsstaicallystaicallyDebugBuildLog.htm"
1>staically - 0 error(s), 0 warning(s)
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

COMPILING the compute_one.f90, i got this:

------ Build started: Project: staically, Configuration: Debug|Win32 ------

Compiling with Intel Fortran Compiler 10.1.011 [IA-32]...
p41.f90

Build log written to "file://C:Documents and SettingsedemMy DocumentsVisual Studio 2005ProjectsstaicallystaicallyDebugBuildLog.htm"
staically - 0 error(s), 0 warning(s)
---------------------- Done ----------------------

Next i tried to debug but I get this msg instead:
"visual studio cannot debug because a debug target has not been set"

Could anyone please assist me with this? And what are the steps required to run a single program that uses a library of subroutines without recourse to a dynamic linked library? Is there any tutorial for a novice to follow? thanks so much.
0 Kudos
8 Replies
andrewq
Beginner
1,660 Views

Hi,

It appears that you have not defined an executable project. You are just compiling and making a static library. To debug, you need a .exe file.

TryADD a new project --> Type:Console application. This application should use your library. Then you can debug the new Console application.

Andrew

0 Kudos
concequence
Beginner
1,660 Views
Thank you for your response, i have done that now. There are two errors found. Now the example file i was running was actually an f95 file and changed the extension to f90 so that the Fortran command statements will be colored in the visual studio IDE. Whenever i use the file in its original ".f95" extension, the whole source code is black text with no colors to tell which is a Fortran statement or not. The errors generated are:

Error 1 Error: Error in opening the compiled module file. Check INCLUDE paths. [MAIN] C:LIBRARIESchap04p41.f90 7
and
Error 2 Compilation Aborted (code 1) C:LIBRARIESchap04p41.f90 1

could that be the source of the problem? Does Intel Visual fortran 10.1 not support Fortran f95? Thanks
0 Kudos
Steven_L_Intel1
Employee
1,661 Views
Intel Fortran fully supports Fortran 95. It does not support, by default, the mistake of naming source files with a .f95 suffix. You can add other file types to be recognized as Fortran source files in Tools > Options > Intel Fortran, but I recommend instead that you rename the files to the accepted convention of .f90 meaning "free-form source". It is a mistake to associate the file type with the standard revision.

You should rename all the source files - evidently you have a module source for module MAIN that is not named with .f90 so Visual Studio does not think it is Fortran.
0 Kudos
concequence
Beginner
1,661 Views
Actually all the subroutine source files and the main program file have ".f90" extensions. Thing is they were originally ".f95" extensions.
0 Kudos
Steven_L_Intel1
Employee
1,661 Views
Is the source of module MAIN part of the project?
0 Kudos
andrewq
Beginner
1,661 Views

Please note that theapplication must have a main function, such as

PROGRAM fmain ... END

If you are not sure, it's better to follow a supplied example came with the compiler.

Andrew

0 Kudos
concequence
Beginner
1,661 Views
Thanks, my problems is this. I have a main program called nm23.f95 and about 10 subroutines written in separate .f95 Fortran files as well.

The
nm23.f95 is the following:
PROGRAM nm23
!---Gaussian Elimination Using LDLT Factorization---
USE nm_lib
USE precision
IMPLICIT NONE
INTEGER::i,j,n
REAL(iwp),ALLOCATABLE::a(:,:),b(:),d(:)
OPEN(10,FILE='nm95.dat')
OPEN(11,FILE='nm95.res')
READ(10,*)n
ALLOCATE(a(n,n),b(n),d(n))
DO i=1,n
READ(10,*)a(i,i:n)
a(i:n,i)=a(i,i:n)
END DO
READ(10,*)b
WRITE(11,'(A)')"---Gaussian Elimination using LDLT Factorization---"
WRITE(11,'(/,A)')"Coefficient Matrix"
DO i=1,n
WRITE(11,'(6E12.4)')a(i,:)
END DO
WRITE(11,'(/,A)')"Right Hand Side Vector"
WRITE(11,'(6E12.4)')b
CALL ldlt(a,d)
WRITE(11,'(/A)')"Lower Triangular Factors"
DO i=1,n
WRITE(11,'(6E12.4)')(a(i,j)/d(j),j=1,i)
END DO
WRITE(11,'(/,A)')"Diagonal Terms"
WRITE(11,'(6E12.4)')d
CALL ldlfor(a,b)
DO i=1,n
a(i,:)=a(i,:)/d(i)
END DO
CALL subbac(a,b)
WRITE(11,'(/,A)')"Solution Vector"
WRITE(11,'(6E12.4)')b
END PROGRAM nm23

Now this file opens in Intel visual Fortran 10.1 as a text file in black and white.

I tried to use the option ----> Intel FORTRAN.. and added a ".f95" extension, hoping for it to recognize the files as a FORTRAN file.

Let me split my problem in two: The first is that even when i include the .f95 extension under the TOOLS menu and restart visual studio 2005, and then try to include the subroutines (static library project) or even the main program (console project), INTEL FORTRAN always views them as text files and i cannot get any BUILD done.

This was why i altered the individual file extensions from .f95 to .f90 in all the subroutines and main program, which 'worked' as the compiler recognized it as a FORTRAN file.

First of all, what can i do to a file with original extensions as .f95 so that the compiler views it as a valid FORTRAN file? Thank you very much

0 Kudos
concequence
Beginner
1,661 Views
the source for module main is not part of the program, its on a separate file.
0 Kudos
Reply