Page 1 of 1

C++ mir_sdr.h importing issues

Posted: Sun Jan 20, 2019 11:17 pm
by AmericanBwana
First off, I'm a complete newbee when it comes to C or C++.

I'm using a 64 bit Windows 10, MinGW 32 (gcc 8.2.0), and CodeLite.

Using API version 2.13.

The following code keeps throwing "Undefined reference to `_imp__mir_sdr_DebugEnable`.

From what I read 'extern "C"' was supposed to disable name mangling.

Code: Select all

#include <iostream>
// #include "mir_sdr.h"
extern "C" {
    #include "mir_sdr.h"
}

int main() {
    float ver;
    mir_sdr_DebugEnable(1);
    std::cout << "Hello testing ...";
//    mir_sdr_DebugEnable(1);
//    mir_sdr_ApiVersion(&ver);
    return 0;
}


I'll be able to start fleshing my project out once I get past this hurdle.

Thanks much
AB

Re: C++ mir_sdr.h importing issues

Posted: Mon Jan 21, 2019 5:57 pm
by ON5HB
Try this instead:

Code: Select all

#include <mirsdrapi-rsp.h>


It looks for a function that seems not to be there, it's my guess your inclusion isn't the right file and thus lacking the mir_sdr_DebugEnable function.

Re: C++ mir_sdr.h importing issues

Posted: Wed Jan 23, 2019 3:57 pm
by AmericanBwana
Bas,
Thank you for the reply.

The .h file I could find in the API directory was mir_sdr.h.

I was able to get it kind of working by compiling and linking directly on the command line with

Code: Select all

g++ -c main.cpp, then g++ -o main.exe main.o -L. -lmir_sdr_api


Probably not the 'right' way to do it.

Thanks,
AB

Re: C++ mir_sdr.h importing issues

Posted: Thu Jan 24, 2019 8:27 pm
by ON5HB
Glad you got it working.

I'm not using Windows but Linux, so I could only point you in a direction.

You may want to make a compile-batch file in case you need to compile it again, newer versions or so.
I tend to forget such things after a while :D

Re: C++ mir_sdr.h importing issues

Posted: Fri Jan 25, 2019 5:49 pm
by AmericanBwana
Bas,
NP. My home computer is win-10. It's really only used for digital (FT8 / RTTY ) and CW contests.

The project is really to help me learn a new language. Most of my other projects are built on work computers (Mac / CentOS ) using Python, JavaScript, Shell, or what ever.

73,
NN0G (Dana)