Author Topic: update an included file in a fortran program  (Read 1984 times)

Offline gd_on

  • Lives here!
  • ****
  • Posts: 644
update an included file in a fortran program
« on: June 23, 2010, 09:51:11 am »
I have inside a fortran program an included file containing constants or common used declarations.
For example something like in a file toto.f :
       program toto
       include 'myconst.h'
       real tab(dim)
       ...
and in myconst.h something like :
      integer dim
      parameter (dim=10000)

If I modify something in toto.f, build command works normally.
But if I modify something inside the file myconst.h (the value of dim for example), C::B does not know that something has changed and does not re-build itself the program. Of course, It works if I rebuild totally the project.
With a C project, the equivalent works nice.
How can I force C::B to re build my project (and re-compile only files using this included file) if something has changed inside the included file ?

gd_on
Windows 10 64 bits (20H2), svn C::B (last version or almost!), wxWidgets 3.1.5, Msys2 Compilers 10.3.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (sjlj, posix in C:\msys64\mingw32).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13235
    • Travis build status
Re: update an included file in a fortran program
« Reply #1 on: June 23, 2010, 04:45:43 pm »
CB is main a C++ IDE, so Fortran support is lacking in some areas...

Probably the thing that fails in you situation is depslib, you can find it here: http://svn.berlios.de/wsvn/codeblocks/trunk/src/plugins/compilergcc/depslib/src/?rev=6370#_trunk_src_plugins_compilergcc_depslib_src_

If you want to use CB as Fortran IDE you should invest some time in fixing this...

BTW, there is external project (not supported by the CB's team) that tries to make CB suitable for Fortran, see here: http://forums.codeblocks.org/index.php/topic,12778.0.html
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline gd_on

  • Lives here!
  • ****
  • Posts: 644
Re: update an included file in a fortran program
« Reply #2 on: June 23, 2010, 05:44:45 pm »
Thanks for this answer.
I know the topic mentioned (I made a reply in it  :)).
But, in my case, for a more complex project than the example above, I need both Fortran and C, so if I use this second IDE, I'll have probably some other problems because, if I understand well a few things have been adapted/modified/replaced specifically for Fortran and the author says that for C, it's better to use the original C::B (So, may be a few things are then missing for C).
Nevertheless, I have found that if I add manually in the .depend file generated by C::B a line containing "myconst.h" to follow my previous example as there are for C sources, in all routines that use it, it works as expected : if I modify the dim value, only sources using this included file are re-compiled. But, it's manual... :(. I don't know if this addition will not be destroyed in the future by some rebuild process. I tried different things and my added lines are still there :P, but ...  :?

gd_on
Windows 10 64 bits (20H2), svn C::B (last version or almost!), wxWidgets 3.1.5, Msys2 Compilers 10.3.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (sjlj, posix in C:\msys64\mingw32).