繁体   English   中英

在 Ubuntu 上使用 Mingw-w64 进行交叉编译时包括库

[英]Including libraries while cross-compiling using Mingw-w64 on Ubuntu

我正在尝试使用以下库交叉编译程序:

#include <iostream>
#include <string>
#include <curl/curl.h>
#include <bits/stdc++.h>
#include <gmp.h>
#include <fcntl.h>
#include <unistd.h>
#include <vector>

由于项目性质,源码编译下载。 服务器运行 Ubuntu 18.04。 我已经通过运行在不太复杂的程序上使用mingw-w64成功地使用了它:

x86_64-w64-mingw32-g++ api_1.cpp -o api_1.exe -std=c++11 -static

当我在上面的例子上运行它时失败了:

api_1.cpp:3:10: fatal error: curl/curl.h: No such file or directory
 #include <curl/curl.h>
      ^~~~~~~~~~~~~
compilation terminated.

如果没有#include <curl/curl.h>#include <gmp.h>失败。

查看/usr/x86_64-w64-mingw32/include ,这些库都不存在。 如何向mingw-w64添加其他库?

轻松的一天。

下载源 tarball。 提炼:

tar zxvf mylibrary.tar.gz

cd mylibrary

./configure --target x86_64-w64-mingw32 --prefix /usr/x86_64-w64-mingw32

编译:

x86_64-w64-mingw32-g++ myprogram.cpp -o myprogram.exe -std=c++11 -static

暂无
暂无

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

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