C++ Portability between Windows and Linux

Active3 hr before
Viewed126 times

2 Answers


Creating C++ binaries portable to a given platform (osx, linux, windows) or platform version (ubuntu precise or trusty) is absolutely feasible but a poorly documented topic. Often our goal at Mapbox is to support the latest C++11 and C++14 features but maintain code portable to older operating systems like Windows 7, OS X 10.8, and Ubuntu Precise, or RHEL 6/7. This is also feasible. For example its possible to run C++14 binaries on AWS lambda (built on ubuntu precise) even though you can't easily compile them on AWS Lambda.,Ensuring your binaries do not depend in a GLIBC or GLIBCXX version greater than your target linux platform,Using a consistent -D_GLIBCXX_USE_CXX11_ABI flag when targeting C++11 or C++14 and versioning binaries on this if you need to support both.,By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

load more v

iOS, Android and Windows Phone kernels are also written in C. They are just mobile adaptations of existing Mac OS, Linux and Windows kernels. So smartphones you use every day are running on a C kernel.,Mac computers are also powered by C, since the OS X kernel is written mostly in C. Every program and driver in a Mac, as in Windows and Linux computers, is running on a C-powered kernel.,In programming languages one size does not fit all. Here are some reasons that C is unbeatable, and almost mandatory, for certain applications.,Databases are used in all kind of systems: financial, government, media, entertainment, telecommunications, health, education, retail, social networks, web, and the like.

This would be the code for a C function that sends a byte through that UART:

#define UART_BYTE * (char * ) 0x40008000
#define UART_SEND * (volatile char * ) 0x40008001 |= 0x08

void send_uart(char byte) {
   UART_BYTE = byte; // write byte to 0x40008000 address 
   UART_SEND; // set bit number 4 of address 0x40008001 
load more v

Other "undefined-undefined" queries related to "C++ Portability between Windows and Linux"