Author Topic: How to build and debug a mixed (C++/FORTRAN) project  (Read 1224 times)

JD

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
How to build and debug a mixed (C++/FORTRAN) project
« on: December 17, 2015, 06:11:02 pm »
Our team has recently started using SlickEdit 2014 Pro and for single language projects, it's great.  We are struggling with how to build a project (1 workspace with 2 projects) that contains a C++ main and a FORTRAN static library.  We have a Makefile that does it all for us on Linux but would like to use SlickEdit's build system instead.  Even when building the project in SlickEdit using our Makefile, I can't set a breakpoint inside the FORTRAN source.  I can debug into it as long as the initial breakpoint is set in a C++ source file.  Any solution to this?

For reference, we also build this same project on Windows using Visual Studio.  The way we do this is a single solution that contains a C++ console application and a FORTRAN static library that uses the Intel Fortran compiler.  I am assuming we would need to do something similar in SlickEdit in order to use its build system. On Linux, we are using GCC.

Any help would be appreciated.  Thanks in advance.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2254
  • Hero Points: 283
Re: How to build and debug a mixed (C++/FORTRAN) project
« Reply #1 on: December 17, 2015, 08:36:36 pm »
Are you using the GNU Fortran compiler?  If so, I would suggest starting with a GNU C/C++ project and then adding a compile rule for fortran (you have to do this manually by editing the .vpj file).  The compile rule needs to be dropped in at the end of the <Config> section, right after then end of the </Menu> section.

Code: [Select]
<Rules Name="Compile">
<Rule
InputExts="*.f"
OutputExts="*.o"
LinkObject="1">
<Exec CmdLine='gfortran -c -g -o "%bd%n.o" "%f"'/>
</Rule>
</Rules>

I plan on adding a project template for GNU Fortran for the next major release.

JD

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: How to build and debug a mixed (C++/FORTRAN) project
« Reply #2 on: December 21, 2015, 06:34:16 pm »
Dennis, thanks for the quick answer.  I have done this and building the project works great. Looking forward to the new template as well.  In the near future, we will also be looking at using the Intel suite of compilers (C++ and FORTRAN) so templates for those would be welcomed as well (assuming they aren't already there).

The only issue I'm running into is the ability to debug the FORTRAN source.  When I attempt to insert a breakpoint into the FORTRAN source, I get the following error message: "Breakpoints are not allowed in files that are not source files".  I can step into FORTRAN and debug as long as I am coming from a breakpoint in C++ source.

Is there a setting I am missing somewhere to allow me to break directly inside a FORTRAN source file?

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2254
  • Hero Points: 283
Re: How to build and debug a mixed (C++/FORTRAN) project
« Reply #3 on: December 21, 2015, 06:41:19 pm »
There is a typo in debug.e that is preventing breakpoints from being set in Fortran.  I will create a hot fix for this in the future.  It may be after the new year though.

JD

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: How to build and debug a mixed (C++/FORTRAN) project
« Reply #4 on: April 22, 2016, 03:50:15 pm »
Has this been fixed in any of the newer releases?

nevermind. I just saw this in the v20.0.1 release notes.
« Last Edit: April 22, 2016, 03:54:41 pm by JD »