mingw

Best way to setup a Windows build environment for C/C++

耗尽温柔 提交于 2020-01-22 14:04:10
问题 Basically I want to compile C/C++ using the GCC on Windows. The two competing platforms, as i see it, are MinGW and Cygwin. Each have their own benifits and limitations. MinGW compiles for Windows, whereas Cygwin needs the cygwin .dll. However installing libraries on MinGW is difficult, whereas on cygwin it's easier, using the setup.exe as a 'package manager'. My question is what's the best way to compile on Windows. Would it be better to use MinGW and struggle with libraries (in which case

Best way to setup a Windows build environment for C/C++

*爱你&永不变心* 提交于 2020-01-22 14:03:26
问题 Basically I want to compile C/C++ using the GCC on Windows. The two competing platforms, as i see it, are MinGW and Cygwin. Each have their own benifits and limitations. MinGW compiles for Windows, whereas Cygwin needs the cygwin .dll. However installing libraries on MinGW is difficult, whereas on cygwin it's easier, using the setup.exe as a 'package manager'. My question is what's the best way to compile on Windows. Would it be better to use MinGW and struggle with libraries (in which case

Extend $PATH variable in git bash under Windows

与世无争的帅哥 提交于 2020-01-22 13:27:06
问题 I'm trying to extend my $PATH variable in git bash (MinGW shell) by adding the following to the file ~/.bashrc PATH=$PATH':/c/Program Files/maven/apache-maven-3.2.5/bin' After I did this and restarted the bash it seems like that the $PATH variable was extended like expected: $ echo $PATH MANY_OTHER_PATHS:/c/Program Files/maven/apache-maven-3.2.5/bin But I still cannot execute the programms in the given directory: $ mvn bash: mvn: command not found What went wrong here? How do I extend the

mingw C++ won't compile j0 funciton

坚强是说给别人听的谎言 提交于 2020-01-22 02:41:07
问题 I'm trying to compile a program on Windows using MingW (msys2) and it fails with the j0 function. On Linux it compiles no problem. It seems to hate when I use the -std=c++11 flag on the compiler. How can I get this to compile properly and with the -std=c++11 flag on? Sample code: #include <cmath> int main( int argc, char *argv[] ) { float test = j0( 5 ); } Output $ g++ -std=c++11 test.cpp -o test test.cpp: In function 'int main(int, char**)': test.cpp:6:21: error: 'j0' was not declared in

MSYS2: How to disable automatic translation of pathname to drive letter?

别说谁变了你拦得住时间么 提交于 2020-01-22 02:21:07
问题 I'm facing an issue when testing a C program compiled with mingw in the MSYS2 shell: I wrote a command line parser that accepts options according to the windows convention (starting with / ). If I call my program like this to generate an output file: ./example.exe /o test What ends up in argv[1] is actually O:/ . It works fine when testing from a console window running CMD.EXE . This truly minimal program demonstrates the behavior: #include <stdio.h> int main(int argc, char **argv) { if (argc

Why is there an extra & to pass the address of a non-static member function to a thread in C++?

别说谁变了你拦得住时间么 提交于 2020-01-21 07:32:06
问题 As I understand, the name of a function itself serves as a pointer to it. Therefore, when I have a function, I can create a thread by simply passing its address to the thread constructor, like below: void thread_function { } std::thread threadObj1(thread_function); My confusion is while passing the address of a non-static member function to a thread. For example: class ClassA { public: void nonstatic_function() { } }; ClassA instance; std::thread threadObj2(ClassA::nonstatic_function,

使用Qt5创建第一个控制台程序

十年热恋 提交于 2020-01-20 18:58:59
1、首先选择一个新的项目 2、选择创建 控制台 项目 3、选择名字和创建的路径 4、构建工具 5、翻译文件(Translation File) 主要用于国际化,多语言版本 6、设置编译器为MinGW-64位以及输出目录 7、设置版本控制 8、完成 9、修改代码 修改main.cpp文件为 # include <QCoreApplication> # include <iostream> using namespace std ; int main ( int argc , char * argv [ ] ) { QCoreApplication a ( argc , argv ) ; cout << "Hello,World!" << endl ; return a . exec ( ) ; } 10、运行程序 点击 运行程序。 来源: CSDN 作者: 没刮胡子 链接: https://blog.csdn.net/somken/article/details/104053488

windows下gcc的安装和使用

不想你离开。 提交于 2020-01-19 15:48:33
写在源文件中的源代码是人类可读的源。它需要"编译",转为机器语言,这样 CPU 可以按给定指令执行程序。C 语言编译器用于把源代码编译成最终的可执行程序。这里假设您已经对编程语言编译器有基本的了解了。 (一).安装 1.为了在 Windows 上安装 GCC,需要到 MinGW 的主页 ,进入 MinGW 下载页面,下载最新版本的 MinGW 安装程序。或者到: 下载 Download mingw-get-setup.exe (86.5 kB) 2.运行 Download mingw-get-setup.exe ,点击"运行",continue等,注意记住安装的目录,如 D:\MinGw,下面修改环境变量时还会用到。 3.修改环境变量: 选择计算机—属性—高级系统设置—环境变量,在系统变量中找到 Path 变量,在后面加入 min-gw的安装目录,如 D:\MinGw\bin 4.在开始菜单中,点击"运行",输入 cmd,打开命令行:输入 mingw-get,如果弹出 MinGw installation manager 窗口,说明安装正常。此时,关闭 MinGw installation manager 窗口,否则接下来的步骤会报错 5.在cmd中输入命令 mingw-get install gcc,等待一会,gcc 就安装成功了。 如果想安装 g++,gdb,只要输入命令

What is difference between sjlj vs dwarf vs seh?

独自空忆成欢 提交于 2020-01-18 08:12:08
问题 I can't find enough information to decide which compiler should I use to compile my project. There are several programs on different computers simulating a process. On Linux, I'm using GCC. Everything is great. I can optimize code, it compiles fast and uses not-so-much memory. I do my own benchmark with MSVC and GCC compilers. Later one produces slightly faster binaries (for each subarchitecture). Though compile time is much more than MSVC. So I decided to use MinGW. But can't find any

最简单的Qt5.12配置opencv4.0方法,免Cmake版本

≯℡__Kan透↙ 提交于 2020-01-18 04:07:53
事先采用MinGW编译好的OpenCV4.0.1 https://github.com/huihut/OpenCV-MinGW-Build 在pro文件中加入 头文件路径和库路径 INCLUDEPATH +=D:\OpenCV-MinGW-Build-OpenCV-4.1.1-x64\include LIBS += D:\OpenCV-MinGW-Build-OpenCV-4.1.1-x64\x64\mingw\bin\libopencv_calib3d411.dll LIBS += D:\OpenCV-MinGW-Build-OpenCV-4.1.1-x64\x64\mingw\bin\libopencv_core411.dll LIBS += D:\OpenCV-MinGW-Build-OpenCV-4.1.1-x64\x64\mingw\bin\libopencv_dnn411.dll LIBS += D:\OpenCV-MinGW-Build-OpenCV-4.1.1-x64\x64\mingw\bin\libopencv_features2d411.dll LIBS += D:\OpenCV-MinGW-Build-OpenCV-4.1.1-x64\x64\mingw\bin\libopencv_flann411.dll LIBS += D:\OpenCV-MinGW