mingw32

-static-libstdc++ works on g++ but not on pure gcc?

被刻印的时光 ゝ 提交于 2019-12-07 02:34:18
问题 For the reference I'm using MinGW (GCC 5.3). When compiling a file with g++ file.cc -static-libstdc++ it statically links the C++ standard lib ( libstdc++ ) and produces a 1.9MB executable. However running gcc -lstdc++ -static-libstdc++ file.cc it still dynamically links to libstdc++-6.dll and produces a 34KB executable. Why does -static-libstdc++ only work with g++ but not with pure gcc ? 回答1: The GCC manual, Link Options says: -static-libstdc++ When the g++ program is used to link a C++

Why does my cross-compiling fail?

笑着哭i 提交于 2019-12-06 13:39:28
I'm new to Linux programming and I'm trying to compile a c file including the GTK+ library. My file is called test.c and it's supposed to run on Windows computers. I'm using the command: i586-mingw32msvc-gcc `pkg-config --cflags gtk+-3.0` -o test test.c `pkg-config --libs gtk+-3.0` I get an awful error, I tried to figure out what went wrong by myself but didn't manage to understand what's going on here. This is the output: You're almost certainly running pkg-config with the host metadata files, such output will likely make your cross-compiler, erm, cross. Try this tutorial, it explains how to

Undefined reference to posix_memalign using mingw32

﹥>﹥吖頭↗ 提交于 2019-12-06 11:35:21
I'm using Debian Squeeze, cross compiling for windows targets using mingw32. For a Linux target, I can use posix_memalign to allocate aligned memory. I can't seem to find a way to get this to work for windows targets; I get errors about undefined references. I have tried several alternative functions, to no avail. Example Code: #include <stdio.h> #include <stdlib.h> #include <malloc.h> int main(void) { char *foo; /* works on linux */ posix_memalign(&foo, 1024, 1024); /* deprecated linux */ memalign(1024, 1024); valloc(1024); /* should work on windows only */ _aligned_malloc(1024, 1024); }

Building static library using Code::Block with MinGW

南笙酒味 提交于 2019-12-06 08:24:58
I am using Code::Blocks with MinGW32 on a Windows machine. And I am trying to build a static library. I created a dummy hello world project. There is one single main.c file in the project. However, when I build it, I got the following message. It seems that there is no errors or warnings. It is just that no lib file is generated. mingw32-gcc.exe -Wall -g -c C:\Users\yzhong52\Desktop\hello_static_lib\main.c -o obj\Debug\main.o cmd /c if exist bin\Debug\libhello_static_lib.a del bin\Debug\libhello_static_lib.a mingw32-gcc-ar.exe -r -s bin\Debug\libhello_static_lib.a obj\Debug\main.o sorry - this

Linphone configuration results in multiple undefined Autotools macros

懵懂的女人 提交于 2019-12-06 05:26:32
I have downloaded the Linphone opensource and build using MINGW. I have followed the steps given by the README.mingw. When I use the command "./autogen.sh", I got the following error. + aclocal -I m4 -I /usr/local/share/aclocal -I /share/aclocal aclocal:m4/po.m4:36: warning: macro `AM_PATH_PROG_WITH_TEST' not found in librar y aclocal:m4/po.m4:61: warning: macro `AM_PATH_PROG_WITH_TEST' not found in librar y aclocal:m4/po.m4:78: warning: macro `AM_PATH_PROG_WITH_TEST' not found in librar y aclocal:m4/gettext.m4:170: warning: macro `AM_ICONV_LINK' not found in library configure.ac:185: warning:

Embed manifest file to require administrator execution level with mingw32

流过昼夜 提交于 2019-12-05 22:28:45
问题 I'm cross compiling an application with i586-mingw32msvc under ubuntu. I'm having difficulties understanding how to embed a manifest file to require administrator execution level with mingw32. For my example I used this hello.c : int main() { return 0; } this resource file hello.rc : 1 Manifest "hello.exe.manifest" this manifest file hello.exe.manifest : <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

Cross compiling Direct3D on Linux with mingw

让人想犯罪 __ 提交于 2019-12-05 11:59:05
How to configure mingw32 to cross-compile Direct3D Apps for Windows? Is there any possibility? I have actually succeeded compiling code from this tutorial: http://www.directxtutorial.com/Tutorial9/B-Direct3DBasics/dx9B4.aspx - using Code::Blocks on Kubuntu with i586-mingw32msvc-g++. I needed to add #define UNICODE and remove the #pragma ... parts to do this, and I used header files from /usr/i586-mingw32msvc/include and libs also from mingw package. However I cannot compile code from this tutorial: http://www.directxtutorial.com/Tutorial9/B-Direct3DBasics/dx9B5.aspx Mingw doesn't have d3dx9.h

Struct packing and alignment with mingw

我的未来我决定 提交于 2019-12-05 10:41:23
I am emulating code from an embedded system (stm32, Keil µVision 5, MDK-ARM) on a PC (mingw32, 32bit arch). The alignment of the ARM compiler does not match my desktop mingw build: // ARM Code (ARM compiler uses __packed) typedef __packed struct _file { uint8_t var1; uint16_t var2; } FILE; // PC mingw gcc code trying to emulate layout above. typedef struct __attribute__((packed, aligned(1))) _file { uint8_t var1; uint16_t var2; } FILE; In the source I do the following: file.var1 = 0x22; file.var2 = 0xAA55; which is then written to memory. When I read the memory on the embedded system it shows

-static-libstdc++ works on g++ but not on pure gcc?

笑着哭i 提交于 2019-12-05 06:53:42
For the reference I'm using MinGW (GCC 5.3). When compiling a file with g++ file.cc -static-libstdc++ it statically links the C++ standard lib ( libstdc++ ) and produces a 1.9MB executable. However running gcc -lstdc++ -static-libstdc++ file.cc it still dynamically links to libstdc++-6.dll and produces a 34KB executable. Why does -static-libstdc++ only work with g++ but not with pure gcc ? The GCC manual, Link Options says: -static-libstdc++ When the g++ program is used to link a C++ program, it normally automatically links against libstdc++. If libstdc++ is available as a shared library, and

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