diff --git a/c++/Makefile.am b/c++/Makefile.am index 956427804..8756829ed 100644 --- a/c++/Makefile.am +++ b/c++/Makefile.am @@ -4,3 +4,9 @@ libhamlib___la_SOURCES = rigclass.cc rotclass.cc libhamlib___la_LDFLAGS = -no-undefined -release @VERSION@ -version-info 0:0:0 libhamlib___la_LIBADD = ../src/libhamlib.la +noinst_PROGRAMS = testcpp + +testcpp_SOURCES = testcpp.cc +testcpp_LDADD = libhamlib++.la +testcpp_LDFLAGS = @BACKENDLNK@ +testcpp_DEPENDENCIES = libhamlib++.la @BACKENDEPS@ diff --git a/c++/testcpp.cc b/c++/testcpp.cc new file mode 100644 index 000000000..2ca82b932 --- /dev/null +++ b/c++/testcpp.cc @@ -0,0 +1,26 @@ + +/* + * Hamlib sample C++ program + */ + +#include +#include + +int main(int argc, char* argv[]) +{ + Rig myRig = Rig(RIG_MODEL_DUMMY); + + try { + myRig.open(); + myRig.setFreq(MHz(144)); + cout << myRig.getLevelI(RIG_LEVEL_STRENGTH) << "dB" << endl; + cout << "Modes for freq 14.332: " << myRig.RngRxModes(MHz(14.332)) << endl; + myRig.close(); + } + catch (const RigException &Ex) { + Ex.print(); + return 1; + } + + return 0; +}