1

I have installed netcdf fortran successfully. I have a program that calls the netcdf module, and I was able to compile (build) it on Code::Blocks without any warning and error. But, when I run the program I got an error message saying that 'Error while loading shared libraries: libnetcdf.so.7'. How can I fix this problem?

Habtie27
  • 35
  • 8
  • You need to provide much more details about your system configuration. See [ask] and [mcve]. Especially you need to show your paths to the libraries and the relevant environment variables like `LD_LIBRARAY_PATH`. – Vladimir F Героям слава Mar 07 '21 at 09:50
  • Potential duplicate https://stackoverflow.com/questions/480764/linux-error-while-loading-shared-libraries-cannot-open-shared-object-file-no-s/28460293 https://stackoverflow.com/questions/4514997/error-loading-shared-libraries?noredirect=1&lq=1 Please read it carefully. Try exporting the path to the library in `LD_LIBRARAY_PATH`. – Vladimir F Героям слава Mar 07 '21 at 09:53
  • Thanks for your suggestions. I had exported the path to the library in LD_LIBRARAY_PATH. Now I found the solution, and the problem was me not letting code::blocks link to the library. – Habtie27 Mar 07 '21 at 15:39

1 Answers1

0

Now I found the solution, and the problem was me not letting code::blocks link to the library. I first exported the path to the library in LD_LIBRARAY_PATH. Then I followed the following step to add the library to code::block run time. Project----build option------linker-------add [the directory where the netcdf library is installed]

Habtie27
  • 35
  • 8
  • Good that you found a solution but it would be good to share how you solved your problem. – albert Mar 07 '21 at 17:23
  • Sure I can do that. I first exported the path to the library in LD_LIBRARAY_PATH. Then I followed the following step to add the library to code::block run time. Project----build option------linker-------add [the directory where the netcdf library is installed]. – Habtie27 Mar 08 '21 at 21:27
  • Please add this information in your answer, not in a comment. – albert Mar 09 '21 at 08:32