-1

I don't actually know where to start and what keywords to use for searching more, but can we simply make a programs in C++ that runs in Linux as well as Windows. I guess we are talking about binary files. Does it change the style of programming or do I just have to compile them in different way? If I open a Visual Studio on my Windows machine and I start creating a simple application which shows a string "Hi. You just execute me." in C++. Does it run on both of machines? Is there something I have to know about?

1
  • This is a general programming question that is off-topic here. Questions about cross-platform programming are (in general) on-topic on Stack Overflow, but you'd need to be more specific in what you were asking. Commented Nov 23, 2016 at 4:46

1 Answer 1

0

i often use wxwidgets, this places a layer in the code that you work with, which at compile time replaces references to windows / gtk...

it does change the way you code as instead of using gtk class or windows.h class direct, you'll use wxwidgets classes which get replaced with appropriate ones at compile time.

this gets the "real feel", as the end result is an application that is 100% native, using native class and gui.

other options are stuff like mono, qt, java... these all have the goal of standardization through an additional layer carried over to the host OS. basically they have a platform that runs in any env, and you can run your application on this platform.

going back to wxwidgest and the code style, you will find there are some things that wxwidgets doesn't have a wrapper class for. for example serial com ports, and linux / windows handle this very differently. For this you'd have to double code (define code for windows and code for linux).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.