Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about working directory #166

Open
cloudy-sfu opened this issue Oct 26, 2024 · 0 comments
Open

Question about working directory #166

cloudy-sfu opened this issue Oct 26, 2024 · 0 comments

Comments

@cloudy-sfu
Copy link

I'm installing Fortran 90 environment in Windows, with JetBrains CLion and your plugin, with "mingw-w64".

With default "Run/debug configurations" in CLion, building and running a "Hello world" example will raise an error: cannot find libgfortran-5.dll ... It means "CMake" file only recognizes gfortran.exe itself, but cannot recognize any DLL in the same folder.

My "CMake" file is:

cmake_minimum_required(VERSION 3.29)
set(CMAKE_Fortran_COMPILER "C:\\Users\\username\\Desktop\\tech\\mingw64\\bin\\gfortran.exe")
project(learn_f Fortran)
enable_language(Fortran)
add_executable(learn_f main.f90)

I tried to include the .../mingw64/bin folder with link_directories or link_module or link_libraries in CMake file, but none of them works. I also tried to include .../mingw64/bin in environment variable PATH. I tried three places of PATH: CLion "Run/debug configurations", system settings, and CMake file. However, still none of them works.

Finally, I found a solution: I set the "working directory" to .../mingw64/bin in "Run/debug configurations" and this error is resolved.

image

However, set the "working directory" means cd to .../mingw64/bin in terminal. I'm worried if it will break the relative path in the program. For example, if I import package.f in main.f, I'm not sure if it can correctly locate package.f. (Please allow me to use Python term, because I'm a beginner of Fortran, I don't know how "import" works in Fortran.)

Is my practice of setting the "working directory" to .../mingw64/bin the correct way?

Thanks for answering my question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant