Error while loading shared libraries: libnetcdf.so.7 - fortran

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?

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]

Related

Linking boost library in node native module, object file requiring alternative library version

I recently had the need to pull in the Boost Graph Library for one of the native node modules that I work on, along with boost serialization. There is a separate VS project that I do all of my development and testing for this module. The project compiles, links, and works as expected when run from the VS project.
I am having issues when I try to link the static serialization library with my module when building with node-gyp. I have included the full path to the serialization library in the libraries section of the binding.gyp file. In the object file produced from the node-gyp compiled file, the following line is causing a linker failure:
/FAILIFMISMATCH:"_CRT_STDIO_ISO_WIDE_SPECIFIERS=0"^#^Dlibboost_serialization-vc140-mt-s-x64-1_67.lib^#^Dlibboost_serialization-vc140-mt-s-x64-1_67.lib^#^Duuid.lib^#^Duuid.lib^#
The object file is expecting libboost_serialization-vc140-mt-s-x64-1_67.lib. When the build process tries to link the file, the linker spits out an error:
LINK : fatal error LNK1104: cannot open file 'libboost_serialization-vc140-mt-s-x64-1_67.lib'
However, boost built libboost_serialization-vc141-mt-s-x64-1_67.lib which is a different version than what the object file is expecting. I have tried to build the version that the object file is looking for, but I cannot seem to get boost to do so (each time I try, it skips all of the targets, even though I am specifying an alternative toolset).
How can I change the library version that the object file is expecting?
When I tried to build the "right" version of the serialization library, I had been using toolset=msvc-140. It should have been toolset=msvc-14.0. Sometimes I am dumb.

Link glew.lib as a static library with eclipse

I am a newbie in C++, I made many searches before I ask, I started OpenGL tutorial with C++ , I am using eclipse with GNU cross compiler, I know how to like static libraries with libXXX.a format then I want to use GLEW library, I have its source code and a precompiled version for windows which is libglew32.lib, if I use make to compile the source code I get an error which is
make (e=2): The system cannot find the file specified.
Makefile:131: recipe for target 'tmp/cygwin/default/shared/glew.o' failed
make: *** [tmp/cygwin/default/shared/glew.o] Error 2.
if I put the library in the libraries folder and add it to the linker as I do with other libraries I get errors in compiling the project like undefined reference to 'glewExperimental' or Invalid arguments 'Candidates are:void glfwMakeContextCurrent(*)'
so I have 2 questions:
how can I compile the source code correctly to a static library which I can use in eclipse.
can I add .lib files to use with eclipse? if yes, how can I do?
I compiled it using gcc and lined by ar finally I get the libglew.a

Compiling LZ4 compression library on Windows

I'm trying to use the LZ4 compression library with a C++ project in Visual Studio 2013. I need to build the .dll files for it so I can link it in the project. I'm trying to use mingw to build it with the make file, but that is throwing unpleasant errors. Navigating to the base directory of the repository and running mingw32-make.exe gives the following error output:
process_begin: CreateProcess(NULL, uname, ...) failed.
The filename, directory name, or volume label syntax is incorrect.
Makefile:72: recipe for target 'lz4programs' failed
mingw32-make: *** [lz4programs] Error 1
I'm not overly familiar with compiling make files on Windows, and am having difficulty with figuring out what's causing the error. Additionally, in something that I find rather odd given how popular this compression library is, I cannot find any information online about compiling it for Windows. Any assistance in getting this thing to compile would be greatly appreciated.
I was able to use CMake with the CMakeLists.txt file in the cmake_unofficial folder to compile the library and the lz4 executable.
The solution is compiling a static version of the library. If you want a dll version, you should be able to experiment with the Visual Studio settings to get the dll if the static library isn't sufficient.

Linker can't find lib in Eclipse/JNI/ANT

I am trying to build a large Java/c++ project involving JNI and ANT in Eclipse, under Linux. One of the source c++ files calls the log10() function for mathematical calculations. The project compiles fine, but fails at linking, where it complains that it cannot find the libm.so library necessary to link log10().
My problem is that I am unable to properly tell Eclipse to link that file, even after the following steps:
Added the correct library path in the linker options,
Added a reference to libm in the linker include list,
Added -lm to the full compile options list,
Set LD_LIBRARY_PATH to point to the library's location,
Copied the library to the current directory.
What am I doing wrong/has anyone had such experiences with correctly linking libs in Eclipse? Any suggestions?
This is a bit confusing.
If you fail to find your library at runtime inside your java environment :
Try loading your .so library inside the java environment before making any calls to log10.
System.LoadLibrary("m");
Notice how I left "lib" and ".so" out.
However, you are complaining of a Linker problem from C++, you cannot link to a dynamic file. You can only link to a static library, or a static export library (so you need a libm.a file to which to link at compile time, and then your program will require libm.so at runtime).
Could you post the exact message you are receiving and when you are receiving it ?

Trying to run SFML HelloWorld code and i'm getting and error

When I run this code I get the error "The program can't start because sfml-window-2.dll is missing from your computer." I linked all the libraries and header files like the tutorial showed me but i'm still getting this error
Link SFML staticaly. Use libraries with -s postfix and add SFML_STATIC to defines. I think it's the best way to link SFML on Windows (dll hell!).