Author Topic: does anyone know of a work around for this problem  (Read 3420 times)

Offline zmth

  • Single posting newcomer
  • *
  • Posts: 4
does anyone know of a work around for this problem
« on: September 11, 2015, 11:44:05 pm »
using gfortran i am using a module which i first must use a -c switch so produce a module.o file from say a module.f90 file then link it for the main program to use so the two steps are:

gfortran -c module.f90
gfortran main.f90 module.o

The first step produces module.o and  ic.mod where ic is the name of the module in the module.f90 file
These two steps work at the dos command line, that is not using code::blocks at all, and produce a valid working a.exe file. I guess it's too much to ask that code::blocks could be automated to do this totally within the code block gui or ide or whatever you call it. BUT anyway I should be able to apply the -c switch in code blocks (for just the first step) according to the directions by going to settings,compiler settings , other options and i put in that box
                      -c
and press ok which is exactly what it should do to get the same as gfortran -c module.f90
BUT it doesn't ! Gives error and does not produce the module.o and ic.mod files as it should.

For example in dos could make a .bat file to do both of these. Too bad codeblocks could not be automated to do this totally within the codeblocks ide/gui program. That would be the best. I have used code blocks for standard comiling with success but not doing these two steps with the -c flag and then attaching a module.o file but as per above it would not even just apply the -c flag for the first step !

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7323
    • My Best Post
Re: does anyone know of a work around for this problem
« Reply #1 on: September 12, 2015, 12:39:43 am »
Please read the FORTRAN forum and post your question there.
https://groups.google.com/forum/#!forum/cbfortran

If you want help here on this forum; post a full re-build log or be ignored.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline zmth

  • Single posting newcomer
  • *
  • Posts: 4
Re: does anyone know of a work around for this problem
« Reply #2 on: September 13, 2015, 03:16:58 am »
problem is NOT gfortran as it does compile from command line and run.
ok i will make it real simple for you this time using only one small file which also DOES compile at the command line and run in dos but not here in code blocks version 1.3.12 using gfortran

module err
integer*1 i
end module err
use err
end

that is the complete code (can even leave out the integer*1 i statement and same problem) named the file moderr.f90  I am running windows 7 home edition

Here is the log

C:\Simply Fortran 2\moderr.f90:3.14:
end module err
              1
Fatal Error: Can't open module file 'C:\Simply Fortran 2\moderr.os_output_dir/err.mod0' for writing at (1): No such file or directory
gfortran.exe -J"C:\Simply Fortran 2\moderr.o"s_output_dir -ffast-math -O3 -c   -I"C:\Simply Fortran 2\mingw-w64" -I"C:\Simply Fortran 2\fwin" -I"C:\Simply Fortran 2\mingw-w64\mingw\bin" -I"C:\Simply Fortran 2\mingw-w64\x86_64-w64-mingw32" -I"C:\Simply Fortran 2\mingw-w64\lib\gcc\x86_64-w64-mingw32\4.9.2" -I"C:\Simply Fortran 2\mingw-w64\lib\gcc\x86_64-w64-mingw32\4.9.2\include" -I"C:\Simply Fortran 2\gdb64" -I"C:\Simply Fortran 2\mingw-w64\x86_64-w64-mingw32\lib64" -I"C:\Simply Fortran 2\mingw-w64\x86_64-w64-mingw32\lib32" -I"C:\Simply Fortran 2\mingw-w64\mingw\include" -I"C:\Simply Fortran 2\gdb64\bin" -I"C:\Simply Fortran 2\gdb64\share" -I"C:\Simply Fortran 2\build" -I"C:\Simply Fortran 2\mingw-w64\lib\gcc\x86_64-w64-mingw32\4.9.2\finclude" -I"C:\Simply Fortran 2\mingw-w64\lib\gcc\x86_64-w64-mingw32\4.9.2\include-fixed" -I"C:\Simply Fortran 2" -c "C:\Simply Fortran 2\moderr.f90" -o "C:\Simply Fortran 2\moderr.o"
Warning: Nonexistent include directory "C:\Simply Fortran 2\moderr.os_output_dir"
Fatal Error: Can't open module file 'C:\Simply Fortran 2\moderr.os_output_dir/err.mod0' for writing at (1): No such file or directory
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 1 warning(s) (0 minute(s), 0 second(s))

get the same type errors when using a previous version say 4.8 of gcc...
no extra compiler flags or options , codeblocks did not crash and it does work for most other straight forward files not involving modules or extra linking etc.


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Re: does anyone know of a work around for this problem
« Reply #3 on: September 13, 2015, 10:41:04 am »
Do you use a project?
Can you pastebin it somewhere, so we can inspect it?
Have you modified the settings of the gfortran compiler?
(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!]