[SOLVED] LMS_funcs not recognized


I’m making a simple “Hello World” with LimeSDR but I’m having some sort of problem.
My code should very simple recognize that the LimeSDR is connected to the host. So far, so good, what I have is this:

#include “Limesuite.h”

using namespace std;

//Device structure, should be initialize to NULL
lms_device_t* device = NULL;

int main()
//Find devices
int n;
lms_info_str_t list[8];
n = LMS_GetDeviceList(list);
cout << “Number of devices found:” << n << “.” << endl;
return 0;

It is adapted from the examples at the LimeSuite repository. Anyway, I have added the Limesuite.h header (and the LMS7002M_parameters.h header that Limesuite.h requires), but, when I try to run the code, I get this: “Undefined reference to LMS_GetDeviceList”.

I believe that the problem is that I don’t have the file “Limesuite.cpp” that specifies the implementation of LMS_GetDeviceList. But I can’t find that file. Or is it something else? Am I wrong?

Thanks in advance!

Implementation of these functions is in LimeSuite library. As you are referring to examples from LimeSuite repository, I assume that you are compiling LimeSuite from source. If you are using Linux, library and header files should be installed in system directories when after compiling LimeSuite you run
sudo make install
sudo ldconfig

Thanks for your quick reply, but I had done that already. The problem persists, there is an undefined reference to those functions. I believe that the problem is that the implementation file is missing (“lime/Limesuite.cpp”).

Those function are definitely in libLimeSuite.so. Do you pass -lLimeSuite linker parameter when compiling?

Of course you can always copy LimeSuite source files (that contain implementation) to your project instead of linking to the library. But that won’t be a single file.

I’m sorry, but I got a little lost in your reply. What I did was to follow the wiki page for installing Limesuite from source:

“git clone https://github.com/myriadrf/LimeSuite.git
cd LimeSuite
mkdir builddir && cd builddir
cmake …/
make -j4
sudo make install
sudo ldconfig”

Then I checked the examples and wrote that simple code in codeblocks. Since codeblocks recognizes the lime headers already, I think everything is nicely installed.

What should I do now?

You need to link LimeSuite library in your project. I don’t use codeblocks, so I can’t tell where it is. There should be linker options in your project settings. You need to add -lLimeSuite option.

google search suggests that it is in:
Settings -> Compiler -> Linker Settings TAB -> ‘Other Linker Options’ -> There you have to type -lLimeSuite and press OK.

I love you.

Just a correction for future newbies who had the same problem as me with codeblocks: you just have to type LimeSuite.

Man, a guide on how to do all these steps is really needed ASAP.

Thank you, @IgnasJ. Have a great day :slight_smile:

I am a beginner in C++ and I have the same problem as #CrystalMatrix (“Undefined reference to LMS_GetDeviceList”). I tried to type “LimeSuite” in :
Settings -> Compiler -> Linker Settings TAB -> ‘Other Linker Options’
But no way! I try to run the code, I get this: “cannot find LimeSuite”.
Can one help me please!

FYI: I use Code:: Blocks and I test a Hello word code to check if LimeSDR devices is connected to the host or not.

Thanks in advance!