Getting linker errors when including JSBSim library #1220
Replies: 2 comments 1 reply
-
How I've managed to get this project to link: I've added a BUILD_SHARED_LIBS=1 option in CMake and compiled the JSBSim project. This yielded me both .lib and .dll files, which I placed in my project root. So this is showing my lack of understanding of what the .lib file is in AppData. I was under the impression that it is a static library file, and it was the only thing I needed to make JSBSim to work in my project. I'm guessing the JSBSim installer placed this .dll file somewhere on my system, but VS2022 is not configured to use that path? Don't know if this is the correct way of doing things, so I'm not yet marking this question as answered. |
Beta Was this translation helpful? Give feedback.
-
So in terms of
So when building JSBSim you need to configure the build to either generate a static library or to generate a dynamic library (DLL) with an associated import lib. And when you build your application to make use of JSBSim you need to configure your build to specify whether you're wanting to make use of the JSBSim static library or the dynamic library (DLL).
From your initial error message you can tell based on the mention of |
Beta Was this translation helpful? Give feedback.
-
Hello! I want to learn about JSBSim by using it as a library from a c++ program paired with raylib for visualizations.
I am on windows, and I'm using VS2022.
I've downloaded and installed JSBSim with the provided release executable
JSBSim-1.2.1-1348-setup.exe
, configured my VS2022 project to useAppData\Local\JSBSim\include
andAppData\Local\JSBSim\lib
directories for the headers and their implementations.I have a very basic main file:
I first successfully compiled, linked, and executed the program with code only referencing the raylib library and its cpp wrapper. After that, I've included
FGFDMExec.h
and added the lineauto FDMExec = new JSBSim::FGFDMExec();
to check if the JSBSim library is also configured correctly. This is where I've encountered linker errors:These are the compiler flags VS2022 generates from my project configuration:
These are the linker flags:
I've tried compiling the .lib from source, but no luck. Also checked the paths, and spelling.
I am unable to tell if this is simply a VS2022 project configuration error, or something more involved. Maybe I'm misunderstanding how c++ libraries work or how to include them. I've seen a discussion kind of similar to mine, but it was seemingly resolved, and the person had problems with the self compiled library, and not the distributed version.
If anyone has the time and expertise, I would greatly appreciate it if you could help me understand the cause of this error.
Beta Was this translation helpful? Give feedback.
All reactions