mingw

Properly print utf8 characters in windows console

倾然丶 夕夏残阳落幕 提交于 2019-12-28 01:55:33
问题 This is the way I try to do it: #include <stdio.h> #include <windows.h> using namespace std; int main() { SetConsoleOutputCP(CP_UTF8); //german chars won't appear char const* text = "aäbcdefghijklmnoöpqrsßtuüvwxyz"; int len = MultiByteToWideChar(CP_UTF8, 0, text, -1, 0, 0); wchar_t *unicode_text = new wchar_t[len]; MultiByteToWideChar(CP_UTF8, 0, text, -1, unicode_text, len); wprintf(L"%s", unicode_text); } And the effect is that only us ascii chars are displayed. No errors are shown. The

How to stop a program compiled with MinGW (g++) from opening a console window in windows

拥有回忆 提交于 2019-12-27 14:44:09
问题 I compiled a program using MinGW g++. When I run it, it opens a console window in addition to the main application window. What's the compiler flag to stop this? 回答1: I believe the compiler switch for that is -Wl,-subsystem,windows . The -Wl,<options> switch passes <options> to the linker. The -subsystem switch tells the linker which system to target when generating the executable. 回答2: I just add -mwindows to linker flags. 来源: https://stackoverflow.com/questions/4441551/how-to-stop-a-program

Embedding binary blobs using gcc mingw

依然范特西╮ 提交于 2019-12-27 11:00:36
问题 I am trying to embed binary blobs into an exe file. I am using mingw gcc. I make the object file like this: ld -r -b binary -o binary.o input.txt I then look objdump output to get the symbols: objdump -x binary.o And it gives symbols named: _binary_input_txt_start _binary_input_txt_end _binary_input_txt_size I then try and access them in my C program: #include <stdlib.h> #include <stdio.h> extern char _binary_input_txt_start[]; int main (int argc, char *argv[]) { char *p; p = _binary_input

Golang modules 初探

谁说我不能喝 提交于 2019-12-26 13:28:46
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 今天天色刚刚亮起,起床看到golang 1.11正式发版了,有着两个重要的特性:modules和WebAssembly。 本博文只要说的是modules,从Java转golang的同学肯定是对golang的包管理充满了无奈之情,我也曾在博客中介绍过 glide ,也介绍过 dep ,现在我们再一次升级介绍modules。 什么是modules 现在都在说modules,那么它是什么? 到文档看看 Modules, module versions, and more : A module is a collection of related Go packages. Modules are the unit of source code interchange and versioning. The go command has direct support for working with modules, including recording and resolving dependencies on other modules. Modules replace the old GOPATH-based approach to specifying which source files are used

算法1----环境的安装

廉价感情. 提交于 2019-12-25 13:10:52
通常用c编写算法。我使用的编辑器是vs code,环境是win,这样需要安装编译器,gcc。看下文 (一).安装 1.为了在 Windows 上安装 GCC,需要到MinGW 的主页 www.mingw.org ,进入 MinGW 下载页面,下载最新版本的 MinGW 安装程序。或者到: http://sourceforge.net/projects/mingw/files/ ,下载 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++

C Compile Error (No such file or directory, compilation terminated)

自闭症网瘾萝莉.ら 提交于 2019-12-25 12:19:18
问题 I'm on Windows trying to learn some OpenGL. I Installed mingw and have a test file. I put my test.c file in a glut folder, which contains glut files such as the glut32.dll and library file. I used mingw in cmd to run the file using this: gcc opengl.c -o opengl -lGL -lGLU -lglut And I got this error: opengl.c:1:23 fatal error: GLUT/glut.h: No such file or directory #include <GLUT/glut.h> compilation terminated. Not sure what I'm doing wrong, anybody know? Thanks! 回答1: First of all you need to

gnu make : how to make conditional cflags

岁酱吖の 提交于 2019-12-25 05:33:08
问题 I started a simple makefile for my project (MS-windows target, MinGW) with the following : CFLAGS = -g -O0 -Wall -std=c99 CC = gcc CPP = g++ LIBS = PBDUMPER = pbdumper.exe all: $(PBDUMPER) $(PBDUMPER): pbdumper.c $(CC) $(CFLAGS) -o $@ $< $(LIBS) clean: rm -f $(PBDUMPER) .PHONY: clean Now I would like to choose between release and debug compilation. I have changed the variable definitions and implicit rule for debug : CFLAGS_COMMON = -std=c99 CFLAGS_DEBUG = -g -O0 -Wall CFLAGS_RELEASE = -O2

Time functions in mingw

谁说胖子不能爱 提交于 2019-12-25 05:32:18
问题 I am trying to implement the code given in this page http://msdn.microsoft.com/en-us/library/windows/desktop/aa366062%28v=vs.85%29.aspx I am using mingw (gcc) to compile this. But the following lines cannot be compiled. I have included 'time.h'. I searched but cannot locate this '_localtime31_s' or its equivalent in gcc. error = _localtime32_s(&newtime, (__time32_t*) &pAdapter->LeaseObtained); error = asctime_s(buffer, 32, &newtime); Where is the time functions here? Thanks 回答1: The functions

Compiling OpenCV on Windows with MinGW

不打扰是莪最后的温柔 提交于 2019-12-25 04:33:34
问题 I am trying to build OpenCV from source using CLion with MinGW on Windows 10. Unfortunately the provided builds for OpenCV do not include a MinGW build any more. When compiling, I get an error that strsafe.h is missing, although I have Windows SDK and Visual Studio 2015 C++ tools installed. Has anyone tried building OpenCV on the same setup? Tanks! 回答1: Yes, I have recently succesfully built OpenCV 3.0 on Windows 10 and 7 using MinGW-w64 for use with CLion. Suggestions, based on my experience

Protobuf 3.0.0-alpha-1 not compiling on windows

烈酒焚心 提交于 2019-12-25 04:27:24
问题 I'm trying to compile protobuf 3.0.0 alpha 1 on Windows using MinGW 4.9.2 & MSYS. According to the instructions I'm supposed to: ./configure make make check make install I added --prefix=/c/path/to/mingw to configure (How to build Google's protobuf in Windows using MinGW?) but it didnt help. It fails at make with the message: CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/Markus/protobuf-3.0.0-alpha- 1/missing aclocal-1.14 -I m4 /home/Markus/protobuf-3.0.0-alpha-1/missing: line 81: