Skip to content

Instantly share code, notes, and snippets.

View 4bitfocus's full-sized avatar

Kevin Douglas 4bitfocus

View GitHub Profile
@Mefistophell
Mefistophell / RUST.MD
Last active May 13, 2024 11:36
How to Compile a Rust Program on Mac for Windows

Question: I want to compile my Rust source code for the Windows platform but I use macOS.

Solution:

  1. Install target mingw-w64: brew install mingw-w64
  2. Add target to rustup: rustup target add x86_64-pc-windows-gnu
  3. Create .cargo/config
  4. Add the instructions below to .cargo/config
[target.x86_64-pc-windows-gnu]
@ranisalt
ranisalt / cast.h
Created April 11, 2016 18:54
lexical cast in C++11
/* fallback */
template<class T>
T lexical_cast(const char* str)
{
static std::istringstream ss; /* reusing has severe (positive) impact on performance */
T value;
ss.str(str);
ss >> value;
ss.clear();
return value;
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.