Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Lexers for Fortran (77)

<< < (2/3) > >>

MortenMacFly:

--- Quote from: Urxae on August 18, 2005, 12:54:14 pm ---Well, you can hardly expect Code::Blocks or MinGW.org to bundle support for every obscure language (no offence) into the default install. Most people don't need Fortran, those that do need it just have to install support for it separately.

--- End quote ---
Sure - the last thing I am expecting from a professional IDE is Fortran support. I would never use Fortran if I didn't have to. I just said that as an addition to thomas' message. The only thing I am trying to is to enable the G77 compiler since it is based on GCC which is fully supported by Code::Blocks.


--- Quote ---It looks like the linker thinks you want to compile a Windows GUI program, but your object files disagree and want to be a console program. Is your target set to "Console program" in your project properties?

--- End quote ---
Yes, it is set to a console program.


--- Quote ---Settings -> Compiler -> tab "Other" -> Compiler Logging -> Full command line :)

--- End quote ---
Great! Thanks to this I was able to reproduce what is happening. One has to use the way as described by thomas (above) but use not CPP but CC instead for the compiler variable. After that the Fortran programs at least compile (using gcc). Unfortunately for linking "mingw32-g++.exe" is used (Why?) instead of g77 which should be. And that's it finally. If I copy/paste the linker command and replace "mingw32-g++.exe" with "g77.exe" (interestingly even without -lg2c switch) the linking is done correctly. But I don't know how to setup this in Code::Blocks. Any hints?

Morten.

rickg22:
In the Compiler Settings, programs, you can choose which program you're using for linking for your fortran compiler.

A warning tho: Be sure that the extra linker options _DO NOT_ have the "-w," (or was it "-m," ? ) argument, since that's what gcc uses to pass commands to the linker.

tiwag:

--- Quote from: rickg22 on August 18, 2005, 05:31:58 pm ---...Be sure that the extra linker options _DO NOT_ have the "-w," (or was it "-m," ? ) argument...
--- End quote ---

it is "-Wl,"

if you want to use the linker option "--export-all-symbols", you write

--- Code: ----Wl,--export-all-symbols
--- End code ---
in "Other linker options" when using normal gcc c++ compiler.

MortenMacFly:

--- Quote from: rickg22 on August 18, 2005, 05:31:58 pm ---In the Compiler Settings, programs, you can choose which program you're using for linking for your fortran compiler.

--- End quote ---
That was it! I made a copy of the GCC-Compiler and replaced the required programs with g77.exe. Sor far so (very!) good. There is only a minor drawback: It seems as if CodeBlocks can only handle C and C++ extensions, right? Or can I add somewhere additional extension for CodeBlocks to detect fortran files as sourcecode? Why I'm saying this:
One has to enable "Compile file" and "Link file" for each Fortran file seperately. Unfortunately after re-opening the project this setting has gone. I tracked back the reason to cbproject.cpp (in sdk) where it states:
  FileType ft = FileTypeOf(filename);
  localCompile = compile && (ft == ftSource || ft == ftResource);
  localLink = link && (ft == ftSource || ft == ftResource || ft == ftObject || ft == ftResourceBin || ft == ftStaticLib);
Since the extension does not match ftSource of ftResource the flag is being reset silently.

However... I wouldn't wonder if this can be setup as well somewhere...?! Because this is the last thing missing for full Fortran support.

Morten.

Ps.: By the way: In fact even if I hate Fortran but it is still widely used in engineering environments. So supporting Fortran makes the IDE attractive even for such places.

thomas:
This is hardcoded (unluckily).

You can:
1. go to the file src/sdk/settings.h, lines 100-117, and add

--- Code: ---#define FORT_EXT "F"
--- End code ---

2.change src/sdk/globals.h, lines 125-130

from
--- Code: ---else if (ext.Matches(CPP_EXT) ||
ext.Matches(C_EXT) ||
ext.Matches(CC_EXT) ||
ext.Matches(CXX_EXT)
)
return ftSource;
--- End code ---
to

--- Code: ---else if (ext.Matches(CPP_EXT) ||
ext.Matches(C_EXT) ||
ext.Matches(CC_EXT) ||
ext.Matches(CXX_EXT) || ext.Matches(FORT_EXT)
)
return ftSource;
--- End code ---


Rebuild code::blocks, and see it it works (it should, hopefully).

If it works, please make a patch upload it to sourceforge.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version