PGI Visual Fortran: Project from existing code

I have just installed PGI Visual Fortran. I would not like to create a project from existing code with a makefile (File -> New -> Project From Existing Code?). I try that and get an error message:

Class not registered. Looking for object with CLSID: {…}

Any assistance would be appreciated. Thanks!

Hi Anya,

Unfortunately this Visual Studio option does not yet support PVF projects. However, you can create a project using existing source code.

Start with a new empty PVF project (File->New->Project | PGI Visual Fortran->x64 | Empty Project), and then in the solution explorer, right-click on a PVF project. Select “Add > Existing Item” then select one (or more) source files to add to the project.

Hope this helps,
Mat

Hi Mat,

Thank you very much for the reply. This is not what I was hoping for, but yes, it helps. Now, is there any procedure to ask the PGI Visual Fortran to use the user-specified makefile? I have been able to compile my program with pgf90 in Cygwin with a makefile (using the -Mnomain option), but the program wouldn’t compile in the Visual Studio. It outputs lots of basic errors which make it clear that there is something wrong with the dependencies (errors S0142 and S0075, mostly…)

Thanks once again,

Anya

Hi Anya,

What should happen is after you have added our Fortran source to your new project and started a build, if any file fails to compile due to a missing module, then that file will be put at the bottom of the list of files and compiled again. So any dependencies between Fortran files should be taken care of automatically.

You mention the use of “-Mnomain”, leading me to believe that you also have C source? PVF doesn’t include a C compiler so this might be the issue. Can you please post some examples of the errors you’re seeing?

Thanks,
Mat

Hi Mat,

Sorry, my fault: I accidentally added a source file to the project that was never compiled in my makefile and shouldn’t have been part of the project… That was the cause for all the errors.

To answer your question, the reason I use -Mnomain is that I have a module called ‘main’ in my Fortran code (for a reason: it is conceptually an analogue of a main subroutine in C).

Still, coming back to the original issue: is there a procedure to specify my own makefile for the PGI Visual Fortran to use? Alternatively, can I save a Linux-compatible makefile with PGI Visual? I constantly need to compile the code on a Linux server, and I need to have a functional makefile at hand at all times.

Another really important question is whether I can specify command-line options for my programs while debugging or running the executable through PGI Visual Fortran. If these two questions are solved, I should be all set to start using it.

Thank you very much for the help!

Anya

Hi Anya,

Still, coming back to the original issue: is there a procedure to specify my own makefile for the PGI Visual Fortran to use? Alternatively, can I save a Linux-compatible makefile with PGI Visual? I constantly need to compile the code on a Linux server, and I need to have a functional makefile at hand at all times.

No, but if you have a shared directory (like on a network drive) where you can put your source files, you could then edit them from either Windows (in PVF) or Linux. Of course, you would need to update your Linux makefile if you added new files or changed compiler flags.

Another really important question is whether I can specify command-line options for my programs while debugging or running the executable through PGI Visual Fortran. If these two questions are solved, I should be all set to start using it.

Yes, you can specify command line option by opening the “Project->Properties” dialog window, select the compilation phase (‘Fortran’, ‘Linker’, ‘Resource’, etc), and then select “Command Line”. You’re able to add your command line options in the box labeled “Additional options”.

  • Mat