mingw

Opencv + opencv_contrib + Tesseract 之Qt开发环境搭建

那年仲夏 提交于 2021-01-04 07:35:41
1.软件包准备 opencv源码包地址: 官网 github opencv_contrib源码包地址: github Tesseract源码包地址: github cmake.exe 下载地址: 官网 qt 下载地址: 官网 注意: opencv和open_contrib包的版本号要一致(比如都是3.4.0) Tesseract源码安装参考: Win10 使用MinGW-w64编译Tesseract4.0 2. 在环境变量PATH中添加: C:\Qt\Qt5. 9.0 \ 5.9 \mingw53_32\bin C:\Qt\Qt5. 9.0 \Tools\mingw530_32\bin 一方面方便日后在cmd中直接使用gcc、g++,qmake和mingw32-make 另一方面, 方便下一步cmake查找Qt相关配置 3. 使用cmake生成解决方案 如果提示: 直接将 "CMAKE_SH" 项删除即可。 修改配置如下: CMAKE_BUILD_TYPE : Debug或者Release CMAKE_INSTALL_PREFIX : 指定程序安装位置 ENABLE_CXX11 : 支持c11特性 WITH_QT WITH_OPENGL OPENCV_EXTRA_MODULES_PATH: 若使用opencv_contrib模块,则在此处填写解压后的路径,如 F:\opencv

Visual Studio Code “undefined reference to `WinMain@16'”

末鹿安然 提交于 2021-01-01 13:44:25
问题 so I am trying to make a Windows Desktop Application with c++ in Visual Studio Code and using MinGW as my compiler. I have a file called test.cpp in a folder called src : #ifndef UNICODE #define UNICODE #endif #include <windows.h> int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdLine, int nCmdShow){ const wchar_t name[] = L"Test"; WNDCLASS wc = {}; //wc.lpfnWndProc = WindowProc; wc.hInstance = hInstance; wc.lpszClassName = name; RegisterClass(&wc); HWND hWnd =

Visual Studio Code “undefined reference to `WinMain@16'”

[亡魂溺海] 提交于 2021-01-01 13:38:45
问题 so I am trying to make a Windows Desktop Application with c++ in Visual Studio Code and using MinGW as my compiler. I have a file called test.cpp in a folder called src : #ifndef UNICODE #define UNICODE #endif #include <windows.h> int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdLine, int nCmdShow){ const wchar_t name[] = L"Test"; WNDCLASS wc = {}; //wc.lpfnWndProc = WindowProc; wc.hInstance = hInstance; wc.lpszClassName = name; RegisterClass(&wc); HWND hWnd =

Qt5.9生成dll详细步骤

烂漫一生 提交于 2020-12-28 02:56:29
用Library工程生成一个可调用的dll的详细图文教程,具体内容如下所示: 1.1首先创建一个lib工程,如下图所示: 1.2将类名改为CreateLibs,如下所示,接着选择默认的, 1.3创建完成后,生成一个带global的头文件和一个CreateLibs类。双击打开带global的头文件,如下图所示: 1.4复制带global头文件的如下代码,到createlibs.h的头文件中,如下图所示: #include<QtCore/qglobal.h> #if defined(UNTITLED2_LIBRARY) # define UNTITLED2SHARED_EXPORT Q_DECL_EXPORT #else # define UNTITLED2SHARED_EXPORT Q_DECL_IMPORT #endif 1.5在createlibs.h头文件的public中,加入如下代码: int add(int a,int b); 如下图所示: 1.6在createlibs.cpp源文件中,加入如下代码: CreateLibs::add(int a, int b) { return a+b; } 如下图所示: 1.7重新编译后,在工程所在同级目录里,会生成文件夹build-untitled2-Desktop_Qt_5_9_3_MinGW_32bit-Debug, 1

Error using pthread on Windows with Mingw

◇◆丶佛笑我妖孽 提交于 2020-12-27 06:08:51
问题 I'm trying to use threads on a Windows C program, compiled on an Eclipse environment and Mingw. I've also put -lpthread and -pthread on the compilation command, and included on the program. I made calls to pthread_create(), pthread_cancel() and pthread_exit() where appropriate on my logic. It always works as intended, but that my program ends saying This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

Error using pthread on Windows with Mingw

别等时光非礼了梦想. 提交于 2020-12-27 06:06:30
问题 I'm trying to use threads on a Windows C program, compiled on an Eclipse environment and Mingw. I've also put -lpthread and -pthread on the compilation command, and included on the program. I made calls to pthread_create(), pthread_cancel() and pthread_exit() where appropriate on my logic. It always works as intended, but that my program ends saying This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

c++输出中文乱码解决方案

北战南征 提交于 2020-12-22 05:20:18
问题的原因应该在cmd的编码和c++程序编码(源文件编码)的不同。cmd默认的是gbk编码,而我用的vs code默认是utf-8编码,因而在输出中文文本时会出现乱码。 但我也遇到了一个比较怪异的情况,就是cmd和cpp文件编码都是gbk的情况下输出中文依然会乱码,但是当输出的文本第一个字符是英文或者空格的时候就不乱码了,这个问题依然没有解决,搜索的时候发现有人也遇到过,但也不知道怎么解决的。 所以解决方案就是全部用utf-8编码(搜索到的还有什么local、wcout、字符宽度、L" "什么的,但是没太看懂) 1.在cmd里先运行命令 chcp 65001 然后再在命令行里启动程序。这种修改cmd编码的方式只能持续到这次命令行程序关闭为止。 2.或者在c++源代码里更改cmd编码 #include <cstdlib> // 可以引入system("pause")来实现程序的暂停 using namespace std; // 引入命名空间std,使得std::cout和std::endl可以直接省去std:: int main() { system( " chcp 65001 " ); return 0 ; } 这样有一点我觉得不好的是会显示执行chcp这条命令的返回文本,不太好看 3.使用SetConsoleOutputCP #include <windows.h> //

Linux入门实践笔记(五)——Win下Git配置SSH连接GitHub实现无密提交

爱⌒轻易说出口 提交于 2020-12-19 08:47:25
内容   使用SSH连接GitHub后无需在每次授权时都提供账号和密码。本文演示了Git在Windows系统下通过SSH的方式连接GitHub仓库,以实现无需输入密码进行代码提交。 版本   操作系统:Windows 10   Git version: 2.16.1-64-bit 说明   转载请说明出处: Linux入门实践笔记(五)——Win下Git配置SSH连接GitHub实现无密提交 参考   Connecting to GitHub with SSH   使用SSH密钥连接Github【图文教程】 步骤 一、生成SSH密钥   任意目录下进入Git Bash,执行mkdir指令创建~/.ssh文件夹。 # 在~下创建文件夹.ssh admin@DESKTOP-LNDCVD9 MINGW64 / f $ mkdir ~/. ssh admin@DESKTOP -LNDCVD9 MINGW64 / f $ cd ~/. ssh admin@DESKTOP -LNDCVD9 MINGW64 ~/. ssh $ pwd /c/Users/admin/.ssh   然后进入该文件夹执行ssh-keygen指令生成SSH,其中 -t 选项用于指定密钥生成的算法,此处使用RSA; -C 选项是公钥文件中的备注,此处使用用户邮箱作为备注。 # 执行ssh-keygen指令生成SSH, #

MinGW

跟風遠走 提交于 2020-12-19 08:46:00
什么是MinGW,自行百度或谷歌。 安装了MinGW后,需要将安装目录下的bin文件夹添加到系统的环境变量path中。下面给出bin目录下的可执行程序。 $ ls -al ... ... ... ... gcc.exe // C 编译器 ... ... ... g++.exe // C++ 编译器 ... ... ... mingw32-make.exe // makefile文件执行 可以看到将bin路径放到path变量中后,我们可以在任意时候使用该目录下的命令。 现在假定在 E:/CC 文件夹下创建 hello.cpp 和 Makefile 文件,使用Makefile是在Windows下用MinGW的最重要的理由,至少对于我来说。 // Makefile objs = hello.o cc = g++ edit: $(objs) $(cc) -o edit $(objs) hello.o: hello.cpp $(cc) -c hello.cpp clean: rm $(objs) target.exe 这样我们可以使用 mingw32-make 命令来执行我们的Makefile文件。这里可以看到 mingw32-make.exe 文件名太长,并且不好记,我们可以将其重命名为 make.exe 这样就与Linux下的make命令保持一致了。 E:\CC> make g++ -c

Windows 10 Mac 为Vs Code配置C/C++环境

人盡茶涼 提交于 2020-12-18 03:13:33
2019-06-10 更新: 加上Mac版本的Vscode配置文件 0、前言 实现效果:右键一键编译运行C/C++文件 Vs code的代码效果很好看,也很轻量,所以想为Vs Code配置C/C++环境,折腾了一个下午,实现的最终效果是:可以在Vs code里面一键编译运行C/C++文件(效果和自己在终端输入命令一样)。 但是请注意:这里的设置并没有弄调试环境。只是设置了编译和运行。 1、安装g++/gcc Windows 是默认不带g++/gcc的,所以需要自己下载配置。 而Mac自带gcc/g++,不需要额外安装~ 下载Mingw安装包 , mingw-get-setup.exe ( https://osdn.net/projects/mingw/releases/) 打开安装包,一路next。完成后会弹出一个管理窗口。 在该窗口中,右键 mingw32-gcc-g++-bin ,点击 mark for installation 。 点击左上角的 installation ,选择 Apply changes 。 等待完成 设置环境变量。增加一个PATH: C:/MinGW/bin (默认安装是这个路径,如果安装时修改了,请修改到实际路径。) 打开cmd窗口,输入 g++ -v ,若有结果,则正常。 本文博客: http://www.cnblogs.com/toulanboy/