添加了ui,确认了qt可执行。但opencv出现问题

This commit is contained in:
zjc-zjc-123 2024-11-12 14:47:08 +08:00
parent 6617a3f503
commit ca645a558d
3 changed files with 30 additions and 4 deletions

View File

@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 17)
# OpenCV
if(DEFINED ENV{OpenCV_DIR})
set(OpenCV_DIR $ENV{OpenCV_DIR})
set(OpenCV_DIR ENV{OpenCV_DIR})
message(STATUS "OpenCV_DIR set from environment variable: ${OpenCV_DIR}")
else()
message(FATAL_ERROR "OpenCV_DIR is not set. Please set the OpenCV_DIR environment variable.")
@ -17,7 +17,7 @@ include_directories(${OpenCV_INCLUDE_DIRS})
# Qt
if(DEFINED ENV{Qt6_DIR})
set(Qt6_DIR $ENV{Qt6_DIR})
set(Qt6_DIR ENV{Qt6_DIR})
message(STATUS "Qt6_DIR set from environment variable: ${Qt6_DIR}")
else()
message(FATAL_ERROR "Qt6_DIR is not set. Please set the Qt6_DIR environment variable.")
@ -33,7 +33,7 @@ set(CMAKE_AUTORCC ON)
# cotton_color
add_executable(cotton_color cotton_color.cpp)
# OpenCV Qt
target_link_libraries(cotton_color Qt6::Widgets ${OpenCV_LIBS})
target_link_libraries(cotton_color Qt6::Widgets ${OpenCV_LIBS} comdlg32)
# cotton_color
add_executable(cotton_range Matrox/color_range.cpp)
@ -46,4 +46,8 @@ add_executable(cotton_color2 cotton_color2.cpp)
target_link_libraries(cotton_color2 Qt6::Widgets ${OpenCV_LIBS})
add_executable(color_matching Matrox/template_matching.cpp
Matrox/onnx_running.cpp
Matrox/onnx_running.h)
Matrox/onnx_running.h
Matrox/ui.cpp)
add_executable(ui Matrox/ui.cpp)
target_link_libraries(ui Qt6::Widgets)

14
Matrox/ui.cpp Normal file
View File

@ -0,0 +1,14 @@
//
// Created by zjc on 24-11-12.
//
#include "ui.h"
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QPushButton button("Hello, Qt!");
button.show();
return app.exec();
}

8
Matrox/ui.h Normal file
View File

@ -0,0 +1,8 @@
//
// Created by zjc on 24-11-12.
//
#ifndef UI_H
#define UI_H
#endif //UI_H