I am new to Fortran and trying to run a code that is not my own. When I type the directory where a module is stored the directory is too long and I have to break the line. However when I try to do this an error comes up.
I am dealing with Fortran using Geany in Windows.
Code I am trying to run:
include "G:\My Drive\06. Projects\02. CA_Spain\8. Replications\lmr_red_final\estimation_ed2_no_growth\src\model\params.f90"
include "G:\My Drive\06. Projects\02. CA_Spain\8. Replications\lmr_red_final\estimation_ed2_no_growth\src\output.f90"
include "G:\My Drive\06. Projects\02. CA_Spain\8. Replications\lmr_red_final\estimation_ed2_no_growth\src\glob.f90"
include "G:\My Drive\06. Projects\02. CA_Spain\8. Replications\lmr_red_final &
\estimation_ed2_no_growth\src\optimization\objective_function_mod.f90"
include "G:\My Drive\06. Projects\02. CA_Spain\8. Replications\lmr_red_final\estimation_ed2_no_growth\src\optimization\optimization_mod.f90"
include "G:\My Drive\06. Projects\02. CA_Spain\8. Replications\lmr_red_final\estimation_ed2_no_growth\src\optimization\data_statistics_mod.f90"
program Msw
use params
use output
use glob
use objective_function_mod
use optimization_mod
use data_statistics_mod
...
And this is the error that comes up:
- main_serial.f90:4:0:
- include "G:\My Drive\06. Projects\02. CA_Spain\8. Replications\lmr_red_final &
- Error: Unclassifiable
- statement at (1) main_serial.f90:5:1:
- \estimation_ed2_no_growth\src\optimization\objective_function_mod.f90"
- 1
- Error: Invalid character in name at (1)
Include lines may not be continued, so you cannot break the character filename up in this way.
Instead you should find a way to shorten the file path reference, or (non-portably) allow the compiler to accept longer lines. Shortening the file path may involve renaming/moving the file, creating filesystem links, or using compiler search paths.
From Fortran 2018 (6.4 p4):
An INCLUDE line shall appear on a single source line where a statement can appear
Related
I have a CMakeLists.txt.
I use it for generating a makefile with ccmake.
Then upon make, my sources are compiled ok.
At link time, the command line produced is essentially
/opt/rh/devtoolset-6/root/usr/bin/c++ myprog.cc.o -o myprog -Ldir3 -L/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2 ... -Wl,-rpath,dir4:dir5:/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2 ...
The two spots specifying the search path
/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2
should actually point to
/opt/rh/devtoolset-6/root/usr/lib/gcc/x86_64-redhat-linux/6.2.1
How can I fix this?
I have devtoolset-3 in my system, but I do not know where this search path is set, or how to change it.
I actually expected that to take place automatically after executing
scl-devtoolset-6
(in my .bashrc), the same way the correct version /opt/rh/devtoolset-6/root/usr/bin/c++ is detected without me doing anything else.
Of course, I get many linking time errors due to version mismatches.
The only place where I see the search path set is in line
link_directories(${LIBDIR_MY})
in CMakeLists.txt, and LIBDIR_MY points to dir3, which is correctly added in the linking command line.
But I found no place where .../devtoolset-3/... is added.
Possible origins of -L:
link_directories in CMakeLists.txt: checked.
target_link_libraries: Where? What is the expected file name pattern to look for?
link_libraries: Where? What is the expected file name pattern to look for?
CMAKE_LIBRARY_PATH: Checked. It is not set.
A find_package command: See below
Somewhere else?
This How do I add a library path in cmake? does not add to my question.
Update 1:
There was in fact a find_package(mylib) (actually, with a different name) in CMakeLists.txt.
Going to the dir of mylib and issuing find . -name “*” -type f -exec grep /opt/rh/devtoolset-3 {} \; there were two files that matched:
build/CMakeCache.txt:
two occurrences of devtoolset-3
PETSC_LIBRARIES:STRING=...devtoolset-3...
FIND_PACKAGE_MESSAGE_DETAILS_PETSc:INTERNAL=[...devtoolset-3...][YES][v()]
It appears to me that this stems from file CMake/cmake-modules/FindPETSc.cmake (possibly invoked by line find_package (PETSc REQUIRED) in CMakeLists.txt), which has a line
set (PETSC_LIBRARIES ${PETSC_LIBRARIES_ALL} CACHE STRING "PETSc libraries" FORCE)
and many prior lines
set (PETSC_LIBRARIES_<various terms> ...)
Notes:
I do not know where in that file devtoolset-3 is first detected and set.
build/include/summit/mylibConfig.cmake.
I still could not track down what made devtoolset-3 appear here.
I found the culprit.
As hinted at in Update 1 of the OP, the sequence is the following:
Line
find_package (PETSc REQUIRED) in file (1)
CMakeLists.txt forced processing file (2)
CMake/cmake-modules/FindPETSc.cmake.
Line*1
petsc_get_variable (PETSC_EXTERNAL_LIB_BASIC petsc_libs_external) in file (2)
CMake/cmake-modules/FindPETSc.cmake sets a local cmake variable
petsc_libs_external from the value of the variable
PETSC_EXTERNAL_LIB_BASIC read from file (3)
~/petsc-3.8.2/lib/petsc/conf/petscvariables.
PETSC_EXTERNAL_LIB_BASIC is not set explicitly in file (3)
~/petsc-3.8.2/lib/petsc/conf/petscvariables. Line
include ~/petsc-3.8.2/arch-linux2-c-debug/lib/petsc/conf/petscvariables forces reading file (4)
~/petsc-3.8.2/arch-linux2-c-debug/lib/petsc/conf/petscvariables.
Line
PETSC_EXTERNAL_LIB_BASIC = ... -Wl,-rpath,/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2 -L/opt/rh/devtoolset-3/root/usr/lib/gcc/x86_64-redhat-linux/4.9.2 -Wl,-rpath,/opt/rh/devtoolset-3/root/usr/lib64 -L/opt/rh/devtoolset-3/root/usr/lib64 -Wl,-rpath,/opt/rh/devtoolset-3/root/usr/lib -L/opt/rh/devtoolset-3/root/usr/lib ... in file (4)
/home/sserebrinsky/petsc-3.8.2/arch-linux2-c-debug/lib/petsc/conf/petscvariables brings the "undesired" directories into the executed command line.
*1 (petsc_get_variable is a macro defined in FindPETSc.cmake)
Following up on this question about including source files. I am including a Chapel modules that contains one file called classes.chpl, but my current project also has a classes.chpl. What is the correct disambiguation pattern? When I do
chpl -M/path/src
it notes the conflict, then chooses the classes.chpl in the current directory. Should I compile the module for export as in this page or is there another pattern.
== UPDATE ==
The directory structure looks like
projA/alpha.chpl
/classes.chpl
projB/beta.chpl
/classes.chpl
Where each project depends on the classes in the respective classes.chpl file. Trying to compile projA I am currently using
chpl alpha.chpl -M../projB/
But this causes a conflict, as it tries to use projA/classes.cphl for the classes in both beta.chpl and alpha.chpl.
As described in the module search paths tech note, the Chapel compiler searches for user modules by, in this order:
Looking at .chpl files specified on the command line
Looking at other .chpl files in the directories containing the files specified on the command line
Looking at .chpl files in the paths specified via the -M option or the CHPL_MODULE_PATH environment variable
Since the compiler finds the classes.chpl from the project directory using rule 2, and only finds the /path/src/classes.chpl with rule 3, it chooses the one in the project directory. To get it to choose /path/src/classes.chpl instead, you can specify it on the command line so it is found with rule 1.
chpl mainModule.chpl /path/src/classes.chpl
I have a program which I converted with py2exe to an exe. After that I tried to make an installer with Inno Setup. I included all necessary files like .dll, .pyd, .gif, .wav, the tlc folder (tcl8.5, tk8.5) etc. But after installing the program it gives me this error:
C:\Program Files (x86)\test>test.exe
Traceback (most recent call last):
File "test.py", line 9359, in <module>
File "test.py", line 11, in __init__
File "Tkinter.pyc", line 1745, in __init__
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
{C:/Program Files (x86)/lib/tcl8.5} {C:/Program Files (x86)/lib/tcl8.5} C:/l
ib/tcl8.5 {C:/Program Files (x86)/library} C:/library C:/tcl8.5.2/library C:/tcl
8.5.2/library
This probably means that Tcl wasn't installed properly.
How can I fix this? Thanks in advance.
This solved the problem I had. I've created my Inno Setup (v5.5.5) outside the py2exe output dir named dest (v0.6.9 win32).
Py2exe output dest contains one dir named tcl which contains files and subfolders. So in your Inno Setup script add the following entry to the [Files] section:
Source: dest\tcl\*; DestDir: "{app}\tcl"; Flags: createallsubdirs recursesubdirs
In my case currentWorkingdir\ is added to dest\tcl\*. This gets everything and sends it to DestDir: "(app)\tcl\" which gets the files and folders.
Flags createallsubdirs and recursesubdirs does all the work. This is an excerpt from help:
createallsubdirs
By default the compiler skips empty directories when it recurses
subdirectories searching for the Source filename/wildcard. This flag
causes these directories to be created at install time (just like if
you created [Dirs] entries for them).
Must be combined with recursesubdirs.
I am trying to run Allegro on my mac but I keep getting
main.cpp:1:10: fatal error:'allegro5/allegro.h' file not found
error.
I have installed allegro successfully and I can find the header files in /usr/local/include/allegro5 . I added a path to my environment variable and when I do echo $PATH I can see /usr/local/include. In the sample program I am trying to run the include is like this -
#include <allegro5/allegro.h>
and I run-
make main
I can see the header files I have included, why isn't mac able to find the files present in that path?
As #PaulR mentioned, PATH is where the shell looks for commands, not for where the compiler looks for includes. You could also add the -I/usr/local/include option to your command line as a way to resolve it.
You could check C_INCLUDE_PATH or CPLUS_INCLUDE_PATH or INCLUDE_PATH (not sure which it's looking for).
So, I'm trying to compile Ardour, on my 64-bit Mac (OS X 10.8.5), but it can't find some header files. The header files are located in /opt/local/include, which doesn't show up in gcc's list of search paths, as returned by gcc -x c++ -v -E /dev/null.
I've read How do I add a directory to C header include path?, and tried setting C_INCLUDE_PATH=/opt/local/include, but nothing's changed - gcc still doesn't list it as an include path. (I also tried CPP_INCLUDE_PATH, just in case - no dice.) I can't (reasonably) add a command line option to specifically include that directory, since the project uses a config script. Any ideas?
Typically for C++ it should be:
CPLUS_INCLUDE_PATH=/opt/local/include
export CPLUS_INCLUDE_PATH
You can also set that in your .bash_profile for future use.