I'm trying to cross-compile a program with the following libraries:
#include <iostream>
#include <string>
#include <curl/curl.h>
#include <bits/stdc++.h>
#include <gmp.h>
#include <fcntl.h>
#include <unistd.h>
#include <vector>
Due to the nature of the project, the source is compiled to download. The server runs Ubuntu 18.04. I've succeeded in employing this using mingw-w64
on less complex programs by running:
x86_64-w64-mingw32-g++ api_1.cpp -o api_1.exe -std=c++11 -static
This fails when I run it on the above example with:
api_1.cpp:3:10: fatal error: curl/curl.h: No such file or directory
#include <curl/curl.h>
^~~~~~~~~~~~~
compilation terminated.
Without #include <curl/curl.h>
, #include <gmp.h>
fails.
Looking in /usr/x86_64-w64-mingw32/include
, neither of those libraries are there. How do I add additional libraries to mingw-w64
?
Easy day.
Download source tarball. Extract:
tar zxvf mylibrary.tar.gz
cd mylibrary
./configure --target x86_64-w64-mingw32 --prefix /usr/x86_64-w64-mingw32
Compile:
x86_64-w64-mingw32-g++ myprogram.cpp -o myprogram.exe -std=c++11 -static