OpenHantek / OpenHantek6022

OpenHantek6022 is a DSO software for Hantek USB digital signal oscilloscopes 6022BE / BL. Development OS is Debian Linux, but the program also works on FreeBSD, MacOS, RaspberryPi and Windows. No support for non-Linux related issues unless a volunteer steps in!
GNU General Public License v3.0
867 stars 152 forks source link

c++ error when building from source #340

Closed R-Repo closed 1 year ago

R-Repo commented 1 year ago

[ 28%] Building CXX object openhantek/CMakeFiles/OpenHantek.dir/src/configdialog/DsoConfigAnalysisPage.cpp.o c++: error: unrecognized command line option ‘-VERSION=3.3.2-dirty’ openhantek/CMakeFiles/OpenHantek.dir/build.make:1338: recipe for target 'openhantek/CMakeFiles/OpenHantek.dir/src/glscopegraph.cpp.o' failed make[2]: [openhantek/CMakeFiles/OpenHantek.dir/src/glscopegraph.cpp.o] Error 1 c++: error: unrecognized command line option ‘-VERSION=3.3.2-dirty’ openhantek/CMakeFiles/OpenHantek.dir/build.make:1362: recipe for target 'openhantek/CMakeFiles/OpenHantek.dir/src/configdialog/DsoConfigAnalysisPage.cpp.o' failed make[2]: [openhantek/CMakeFiles/OpenHantek.dir/src/configdialog/DsoConfigAnalysisPage.cpp.o] Error 1 CMakeFiles/Makefile2:151: recipe for target 'openhantek/CMakeFiles/OpenHantek.dir/all' failed make[1]: [openhantek/CMakeFiles/OpenHantek.dir/all] Error 2 Makefile:149: recipe for target 'all' failed make: [all] Error 2 raza@raza-ThinkPad-T440s:~/Open

Ho-Ro commented 1 year ago

Please provide more information about your setup, OS, compiler version, etc.

R-Repo commented 1 year ago

Using Ubuntu 16.04.1 with g++ 4:5.3.1

Do you need anything else?

Ho-Ro commented 1 year ago

I can check at the weekend.

Ho-Ro commented 1 year ago

Ubuntu 16.04.1 with g++ 4:5.3.1

This version is quite old and uses an old CMake version that requires a deprecated syntax. I never checked this and didn't detect my typo.

Please do this change, cd to build and run cmake .. and make again.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b8e0738..23f17fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,7 +48,7 @@ if( ${CMAKE_VERSION} VERSION_LESS "3.12.0" ) # deprecated, but still used in old
     add_definitions( -D_GLIBCXX_ASSERTIONS )
     add_definitions( -D_USE_MATH_DEFINES )
     if ( DEFINED VERSION )
-        add_definitions( -VERSION="${VERSION}" )
+        add_definitions( -DVERSION="${VERSION}" )
     endif()
 else() # 'add_compile_definitions()' was introduced with CMake 3.12
     add_compile_definitions( _GLIBCXX_ASSERTIONS )