This is for a project that was originally all Fortran code. However, we recently added some C code.
Under Settings/Compiler/GNU Fortran Compiler (as a dropdown)/Toolchain Executables...the path to gfortran.exe is specified.
This is where it gets confusing. There is no Fortran listed in "Program Files" so I have just been using gfortran.exe for the first 3. This seems to override the label of C, C++, linker for dynamic libs. But what happens when you want to use both C and Fortran? Oddly, enough if I put gfortran.exe in all 3 it works (and seemingly compiles the C code). So maybe the dependency is more on the path than the EXE itself? The path does have a C compiler.
Please look at the build log and maybe you can answer the question.
http://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)
Tim S.
Thanks...that does seem to help, but I don't understand it since both seem to use gfortran.exe. How can the C file use fortran.exe?
Here is the line for a FORTAN file:
gfortran.exe -Jobj\Release\ -Wall -O2 -I..\..\A\INCLUDE -c C:\A\Interfaces\LINK5_Interface.f90 -o obj\Release\A\Interfaces\LINK5_Interface.o
Here is the line for a C file:
gfortran.exe -Jobj\Release\ -Wall -O2 -I..\..\A\INCLUDE -c C:\A\SuperLU\c_fortran_dgssv.c -o obj\Release\A\SuperLU\c_fortran_dgssv.o
gcc and g++ are just compiler drivers; they call the real compilers that are likely named cc1plus and cc1.
gfortran likely calls cc1 for "c" code compiling.
Tim S.
If you want to use the C/C++ compilers to build Fortran/C/C++ projects you'll need to set up separate targets for separate languages. Build all the c/c++ code as a static library and link it with the final fortran executable or do the opposite - fortran code in a lib, c/c++ executable.
This is currently the cleanest way to do it, I think.
Ideally someone could expand the build system to support this case, but it is probably a lot of work and probably it won't happen in the near future.
The final link might be complex to handle automatically correctly. For example if you mix c and c++ you need to use g++ for linking. If you don't do it you'll have linking errors, because c++ requires linking its runtime and the c linker doesn't do it. No idea if fortran has its own runtime and how do you use it with the c/c++ linker wrappers.
benkenobi01: What are you talking about? You're not providing a solution as far as I can see. The IDE is a tool. If the tool can do the job and saves you time you should use it. IDEs are not magick either.
The thing is that it compiles OK and the resulting EXE passes benchmark testing for known outputs from the EXE. So it must be working even though I don't understand why. It seems stahta01's thought might be correct?
Most probably it is. GCC uses the file extension to detect the source language. The answer is in the documentation of gfortran most probably, I doubt you'll find it here.
Sounds good. I will accept that. I just wanted a few opinions about things. But since there is as a likely reason for this, and everything checks in the end, I am satisfied nothing is "incorrect" at least. Thanks.
This is another way to look at it - assume that it works if there are no signs it doesn't :)
Quote from: benkenobi01 on February 05, 2021, 08:08:41 AM
Quote from: stahta01 on February 04, 2021, 12:32:48 PM
they call the real compilers that are likely named cc1plus and cc1.
Do you know their actual real name ?
On my GCC compiler toolchain it is cc1.exe for C and cc1plus.exe for C++.
Tim S.