User forums > Using Code::Blocks

CB suddenly will not compile any f90 module

<< < (2/2)

franko:
OK the template is below. First, I've posted all the steps I've taken,
mostly in the first post. They are quite thorough, I think.
Secondly, the problem is 'compiling current file', not 'building a project'.
In fact, I cannot compile a .f90 module that has stood the test of time
(I have used 'nrtype.f90' since about 1996 in various Fortran90 compilers).
Third, via the command line, the module compiles and produces both .mod and
 .o files. Fourth, the module contains no 'use' statements to other modules,
or include files, or any other references.

Here is the template, filled in:

I am running Code::Blocks version 13.12 on Windows 7 64-bit.

The compiler I use is gfortran. I cannot find the gfortran version,
but it appears to have been built with gcc 4.9.2 in 11/2014. The
included 'build-info.txt' is several pages of MingGw...so forth, does
not mention gfortran itself specifically.

When I load the file 'nrtype.f90' into CB, no project open, and select
'Build / compile current file', I get a warning and a related fatal error
about nonexistent '..os_output.dir', which seems to be connected to the
'-J' switch (see build log below). NO output '.o' or '.mod' files are
produced.

I have the source file in directory 'D:\Work', and opened it there with
CB/gfortran. That is where the CB tried to create some default output.

Note that this happens with ANY of my other modules as well,
including valid commercial modules that have been around awhile.

Steps to reproduce problem: As above.

Description of problem.
As described above.

Build log:
gfortran.exe -JD:\Work\nrtype.os_output_dir   -IC:\FortranTools\lib -c D:\Work\nrtype.f90 -o D:\Work\nrtype.o
gfortran.exe  -o D:\Work\nrtype.exe D:\Work\nrtype.o   C:\FortranTools\lib\libfortrantools.a
Warning: Nonexistent include directory "D:\Work\nrtype.os_output_dir"
D:\Work\nrtype.f90:30.17:
END MODULE nrtype
                 1
Fatal Error: Can't open module file 'D:\Work\nrtype.os_output_dir/nrtype.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))
 
Crash report:  Code::Blocks does not crash on this error.

I have already tried ...the things listed in first post
... but none of them worked.

Additionally, it appears that
the '-J' switch is set in the compiler settings / other settings / Advanced Options..
dialog, which comes with a big warning about not doing anything if you
'do not know exactly what you are doing". I do not.

My CB has, in this dialog, as a command line macro,
 "$compiler -J$objects_output_dir $options $includes -c $file -o $object,
in the space under the drop-down 'command', which has selected,
'compile single file to object file'.
Since I have no idea how to fix this, I'm really stuck. I notice that
similar problems with this 'os_output_dir' thing have occurred in
the past, at least once reported on this forum, with no solution listed.

Thanks for any help.
franko

BlueHazzard:
it seems that there is a mixing with the path separators (D:\Work\nrtype.os_output_dir/nrtype.mod0)
i have never used fortran, so i can't tell you if this is a problem, but i would look up, if you can fix this path to pure windows style...

the second thing is:
use projets... c::b is not meant to use it without projects

From the fortran documentation:

--- Quote ----Jdir
    This option specifies where to put .mod files for compiled modules. It is also added to the list of directories to searched by an USE statement.

    The default is the current directory.
--- End quote ---
so this -J command is needed, and as you are using a windows 7 machine, i think you don't have the right to write on your c: drive.
Use a folder within your "Documents" for your project

greetings

franko:
Thank you Blue Hazzard,

I'm not sure what you mean about the path, it is perfectly valid pure windows style, points to the directory "D:\Work", which is the folder 'Work' on the 'D' drive, and is where the source code is and was loaded from. It is certainly valid for CB to try to put the output there. It would be the default. BUT, 'os_output_dir' is nothing I ever entered, nor does it make any sense. It was added by CB alone, has nothing to do with fortran. That is why I am asking on the CB forum.

I do this on 'D' because my 'C' drive is a Solid State Drive, with limited size; it is almost full, but that is where the program files must be located by Windows 7. Part of my space problem is that is where 'windows' puts the 'documents' and other 'libraries' which really eat up space (I'm trying to move them all to D). But, I don't think that is related to the problem, because:

When I run this on my laptop I run with full admin authority, and everything is on the C: drive, I have write permission in the program files. Exactly the same problem occurs, even tho I have erased rebooted and reinstalled CB. There, of course, I am using the path "C:\Work" instead of "D:\Work".

As I said, I am not the only person to have this problem, there was a lady who posted here a year or two ago and got no answers for the same problem with 'os_output_dir'. I have seen this problem reported (no solutions) elsewhere online as well.

Finally, whether I include the compiling in a project or not, the same problem happens - no compiling of the module, with same fatal error. Besides, why does the IDE have the 'Build/Compile current file' command, if not to compile a specific file? In addition, it used to work without fatal errors, albeit with the warning of the same 'unknown' output directory I did not request, '...os_output_dir'. Also, I know of one other capable programmer whose installation of the same system works with 'compile current file' on the same source file, putting out the '*.o' file and '*.mod' files without reporting any error or warning.

As you may see, this strange problem has been a real headache. Of course, I can do the whole thing from command line with no problems . However, if I cannot use the IDE to compile files, it is really not much more that a fancy 'notepad' editor with color., is it?

I am not an accomplished system-level programmer, and have no interest in becoming one. However, I am wondering if CB has created some 'startup script' which has become altered - and perhaps stays on the machine even when CB is removed.

I hope I can find out where that bogus 'os_output_dir' came from. But I am beginning to believe it is a real 'bug' and needs to be reported as such, since I can find no place where solutions are posted.

Thanks again,

Franko

osdt:

--- Quote from: franko on April 03, 2015, 06:28:10 pm ---
--- Code: ---Build log:
gfortran.exe -JD:\Work\nrtype.os_output_dir   -IC:\FortranTools\lib -c D:\Work\nrtype.f90 -o D:\Work\nrtype.o
...
--- End code ---
...
My CB has, in this dialog, as a command line macro,
"$compiler -J$objects_output_dir $options $includes -c $file -o $object"
...
--- End quote ---

It looks like the macro $objects_output_dir is invalid without a project.

Try to create an empty project, choose GNU Fortran as compiler, add the sourcefile, build it.

franko:
Well, you all have zeroed in on what I could not seem to grasp; it appears a project is required to compile, even a single file.

When I did that, the compiles go off without an error. My mistake: I had *tried* to do that, I thought, but in my absent-mindedness I forgot to 'include' the single file in the project. No wonder it did not
compile. Well, Duh.  (<- American slang for 'my bad', or worse)

To me, it appears to be a bit counterintuitive; far easier (for a single file) to just use the command line. But for a larger project, possibly with newly-written source-code modules in place, it makes sense.

Sorry to have wasted bandwidth; thanks very much for the help.

franko

Navigation

[0] Message Index

[*] Previous page

Go to full version