mingw-w64

CMake failing to statically link SDL2

折月煮酒 提交于 2019-12-06 02:25:57
问题 I'm trying to build a simple SDL2 game with CMake and MSYS Makefiles. I want to statically link SDL2 so I can distribute a single executable without having to include the SDL2.dll. Here's my CMakeLists.txt file: project(racer-sdl) cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_EXE_LINKER_FLAGS "-static") include(FindPkgConfig) pkg_search_module(SDL2 sdl2) if (SDL2_FOUND) message(STATUS "Using SDL2") add_definitions(-DUSE_SDL2) include

Undefined reference to CLSID_MMDeviceEnumerator and IID_IMMDeviceEnumerator

做~自己de王妃 提交于 2019-12-05 22:38:32
Trying to compile an example code using COM and CoCreateInstance() using MinGW-w64 in C fails. #include <windows.h> #include <mmdeviceapi.h> #include <endpointvolume.h> #include <stdlib.h> #include <stdio.h> extern const CLSID CLSID_MMDeviceEnumerator; extern const IID IID_IMMDeviceEnumerator; int main( void ) { CoInitialize( NULL ); LPVOID device = NULL; const HRESULT ok = CoCreateInstance( &CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, &device ); CoUninitialize(); return EXIT_SUCCESS; } Compiling with: gcc main.c libole32.a -Wall -Wextra -o a Even though

How to obtain pre-built *debug* version of Python library (e.g. Python27_d.dll) for Windows

五迷三道 提交于 2019-12-05 20:54:27
问题 Firstly, I should state that my current development environment is MSYS + mingw-w64 + ActivePython under Windows 7 and that on a normal day I am primarily a Linux developer. I am having no joy obtaining, or compiling, a version of the Python library with debug symbols. I need both 32bit and 64bit debug versions of the Python27.dll file, ideally. I want to be able to embed Python and implement Python extensions in C++, and be able to call upon a seamless debugging facility using the gdb-7.4 I

How to change HOME directory and start directory on MSYS2?

安稳与你 提交于 2019-12-05 11:52:17
问题 I have installed MinGW-w64 and MSYS2. But how do I change the HOME directory in MSYS2? So that when I type cd $home or cd ~ it goes to another directory that I defined. And how do I write a code so that the starting directory is always where the .bat file is placed on? In cmd I used this code: %~d1 cd "%~p1" call cmd so when I open cmd on my desktop, it starts from the directory on desktop. How can I do a similar thing with msys2? 回答1: If you would like to use your windows home folder as the

Linking libcurl while cross compiling with mingw32 under Linux for Windows

江枫思渺然 提交于 2019-12-05 09:51:51
I have compiled libcurl using mingw32 and am trying to link it with my program using mingw32 for a Windows system from my Linux machine. I was outputted the files, libcurl-4.dll libcurl.a libcurl.la libcurl.lai. I have included them in my mingw32 libs folder at: /usr/x86_64-w64-mingw32/lib I was able to find a few other topics on linking with the libstdc++ and libgcc to take care dependency errors while executed but when trying to add libcurl.a it will not compile period. I used the following: $ x86_64-w64-mingw32-g++ main.cpp -o hello.exe -static-libgcc -static-libstdc++ -static "/usr/x86_64

MinGW64 cannot compile 32bit code

旧时模样 提交于 2019-12-05 05:48:01
问题 I've downloaded MinGW from this link x64-4.8.1-posix-sjlj-rev1 but when I try to build for x86 target I've lots of linkage errors... seems that only x64 lib are installed... I've need to build for x86 and x64 platforms on windows... Have I to download both x64 and x86 or are some simpler ways? Edit I'm using eclipse keplero as IDE I've tryed to build myself a simple hello world program with g++ -m32 -std=c++11 test.cpp -o test32.exe and g++ -m64 -std=c++11 test.cpp -o test64.exe . And all is

python_x64 + C library compiled with mingw_x64 on Windows7 Py_InitModule4

浪子不回头ぞ 提交于 2019-12-05 02:37:33
I'm trying to compile C library for python on Windows7 (64-bit) using mingw-x64. It all worked like a charm with 32-bit versions. I used to compile my library with gcc -shared -IC:\Python27\include -LC:\Python27\libs myModule.c -lpython27 -o myModule.pyd and it worked with 32-bit versions. The same procedure is working with 64-bit linux. But on 64-bit windows7 (using 64-bit x86_64-w64-mingw32 and 64-bit python 2.7.5) I have a problem: C:\Users\sergej\AppData\Local\Temp\cci8TbXw.o:myModule.c:(.text+0x267): undefined reference to `__imp_Py_InitModule4' collect2: ld returned 1 exit status I

vscode写c语言(windows)

拜拜、爱过 提交于 2019-12-05 00:17:53
用vscode学习c语言。 记录vscode配置c语言编译环境。 1.安装vscode(版本1.27) https://code.visualstudio.com/ 下载安装vscode. 2.安装c/c++扩展。 3.安装编译工具mingw-w64 , http://www.mingw-w64.org/doku.php/download 配置环境变量,以WIN10为例 ,此电脑-属性-高级系统设置-环境变量-系统变量-path-添加一条D:\Program Files\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin(你安装编译工具路径) 配置前 配置后 -ps:如果开着vscode配置环境变量,配置完要关掉vscode重开一次。 4.配置文件launch.json,task.json。 新建文件hello.cpp, 按F5弹出选择环境,配置launch.json 点击进去,configurations:里内容如下; { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "enter program name, for example ${workspaceFolder}/a.exe", "args": [],

Static linking with libwinpthread

两盒软妹~` 提交于 2019-12-04 20:31:57
问题 I try to build program with static linked toolchain libraries. I pass: LDFLAGS="-Wl,-Bstatic -lwinpthread -Wl,-Bdynamic -static-libgcc -static-libstdc++" but program linked with shared libwinpthread-1.dll . What I doing wrong? Only way when I got static linked libwinpthreads is pass -static to LDFLAGS . But it break build programs with plugin system. I use mingw-w64 + GCC-4.7.2 from the MinGW-builds project: http://sourceforge.net/projects/mingwbuilds/ 回答1: Try this: -static-libgcc -static

How to compile vim 64-bit on windows using MinGW-64?

烂漫一生 提交于 2019-12-04 17:43:40
I tried to compile vim 64-bit on windows. But I don't know how to use MinGW-64. There's a mingw-32-make in the 32-bit version, which I could use to build. But I didn't find any 'make' program in the 64-bit MinGW. Could you please tell me how to use mingw-64, or any tutorial I could follow? Thank you. It does not matter from which source make program comes, it only just must be able to execute the Makefile. To compile vim with MinGW with specific compiler and Make_ming.mak makefile I used to use the following: Export environment variable CC set to the appropriate compiler (in my case it was 32