I’m very new in developing in C++ and I can’t quite seem to compile and run the example codes that was provided in the limesuiteng repo. Limesuiteng was built from source, so shouldn’t the included files to link the library work?
For reference I’m using VSCode and Pop!_OS (an Ubuntu based distro) to try to get this running.
Any help would be appreciated.
Are you trying to build the examples as your own separate project? What errors you are getting?
Here’s dualRXTX.cpp
unmodified inside limesuiteng_test
directory when I run g++ dualRXTX.cpp -o dualRXTX
in the terminal:
C++ builds are done in two steps. Compilation and linking.
Your command does only the compilation step, so after it’s done it cannot find those functions, because they are located in external library. You need to explicitly specify to your compiler where to find those functions/which libraries should be linked to your application.
In this case you need to add -llimesuiteng
to your command.
I was able to run the command but encountered this after:
I was able to find that specific file, but what am I supposed to do with it?
when linux runs the application, it needs to know where to search for the shared libraries. The default search directories are listed in LD_LIBRARY_PATH
environment variable, so if it doesn’t contain /usr/local/lib, then it won’t find the library. The other solution is to define the library search path during compilation with -Wl,-rpath=
Or you might just simply need to update your system installed libraries cache by sudo ldconfig
These issues you are having are not related to LimeSuiteNG, they are generic C++ build process and host system configuration issue. I suggest using CMake to manage your C++ project, it will handle most of these issues by giving the compiler all the necessary flags and paths.
Thanks, everything is working now! I can’t believe I missed the sudo ldconfig
command and you’ve saved me from a lot of difficulties.
It would be really helpful if you included the example compile command in the documentations or as a comment inside the examples to help newbies like me (:
Thanks again!