简体   繁体   English

在Ubuntu上缺少MinGW的标头依赖项

[英]Missing header dependencies with MinGW on Ubuntu

I'm trying to setup a cross-compiler from my Ubuntu laptop so that I can compile command line programs for Windows. 我正在尝试从Ubuntu笔记本电脑设置一个交叉编译器,以便可以为Windows编译命令行程序。 I have compiled all libraries I need with g++ until now, so I wanted to do the same in order to produce the equivalent Windows binary. 到目前为止,我已经用g ++编译了我需要的所有库,因此我想做同样的事情以产生等效的Windows二进制文件。

I have installed gcc-mingw via apt-get, and it installed a number of binaries. 我已经通过apt-get安装了gcc-mingw,它安装了许多二进制文件。 I have compiled successfully an "Hello World" program for windows using the i686-w64-mingw32-g++ binary. 我已经使用i686-w64-mingw32-g++二进制文件成功地为Windows编译了一个“ Hello World”程序。

However I have some problem during the compilation of my more complex project. 但是,在编译更复杂的项目时遇到了一些问题。 I noticed that this binary includes different folders from the standard g++, and it can't find dependencies (for example, boost headers, bits/predefs.h, etc.). 我注意到该二进制文件包含与标准g ++不同的文件夹,并且找不到依赖项(例如boost标头,bits / predefs.h等)。 Is there a way to setup mingw parameters so that it works as g++ does out of the box? 有没有办法设置mingw参数,使其像g ++一样开箱即用?

I found the problem. 我发现了问题。 The Boost library I was using was one I installed via apt-get. 我使用的Boost库是我通过apt-get安装的库。 Apparently this meant that many #if defined (__GLIBC__) were automatically converted in #if 1 . 显然,这意味着许多#if defined (__GLIBC__)已自动转换为#if 1 This caused the inclusion of some non-cross-platforming header files. 这导致包含一些非跨平台的头文件。 Downloading the library from the website and using it solved the problem. 从网站下载库并使用它可以解决该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM