C++ mir_sdr.h importing issues

Add useful snippets of code or links to entire SDR projects.
AmericanBwana
Posts: 3
Joined: Sun Jan 20, 2019 11:08 pm

C++ mir_sdr.h importing issues

Postby AmericanBwana » Sun Jan 20, 2019 11:17 pm

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
Last edited by AmericanBwana on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

ON5HB
Posts: 124
Joined: Sat Dec 29, 2018 1:07 pm
Location: Heppen - Belgium
Contact:

Re: C++ mir_sdr.h importing issues

Postby ON5HB » Mon Jan 21, 2019 5:57 pm

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.

Reason: No reason
Greetings,

Bas - ON5HB

AmericanBwana
Posts: 3
Joined: Sun Jan 20, 2019 11:08 pm

Re: C++ mir_sdr.h importing issues

Postby AmericanBwana » Wed Jan 23, 2019 3:57 pm

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
Last edited by AmericanBwana on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason

ON5HB
Posts: 124
Joined: Sat Dec 29, 2018 1:07 pm
Location: Heppen - Belgium
Contact:

Re: C++ mir_sdr.h importing issues

Postby ON5HB » Thu Jan 24, 2019 8:27 pm

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

Reason: No reason
Greetings,

Bas - ON5HB

AmericanBwana
Posts: 3
Joined: Sun Jan 20, 2019 11:08 pm

Re: C++ mir_sdr.h importing issues

Postby AmericanBwana » Fri Jan 25, 2019 5:49 pm

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)
Last edited by AmericanBwana on Thu Jan 01, 1970 12:00 am, edited 0 times in total.
Reason: No reason


Return to “Code Corner”

Who is online

Users browsing this forum: js9013 and 4 guests