Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Cross-platform targeting  (Read 3519 times)

0 Members and 1 Guest are viewing this topic.

scyth3s

  • Newbie
  • *
  • Posts: 20
    • View Profile
Cross-platform targeting
« on: February 22, 2011, 05:13:24 am »
Before you read too far, I have no direct problem. I'm just trying to learn from the get-go how to write SFML apps that work on Mac, Linux, and Windows all from the same Code Blocks (or VS 2010) project, and I've got a few questions.

1: If I link statically, will the same .exe (compiled on Windows in C::B or VS 2010) run on all 3 platforms, or will I need to actively import the project on each platform and build it there to make it cross-platform?

2: Same as #1, but with dynamic instead of static linking.

3: Should I be trying to develop in Linux instead of Windows (I'm on Windows)?

4: Do you have any other hints or suggestions?
"My church is not full of..."

Xorlium

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Cross-platform targeting
« Reply #1 on: February 22, 2011, 07:03:39 am »
You will need to recompile on each platform, no matter if it's dynamic or static.

You can develop in whatever you want, and if you keep an eye out and plan accordingly from the start, it should be very easy to recompile in all three platforms (Just don't use stuff like windows.h)

TechRogue

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Cross-platform targeting
« Reply #2 on: February 23, 2011, 06:45:14 am »
So far, the code I write on Linux with SFML/C++  work with no changes whatsoever on Windows. Haven't tested with MacOS, but I can't imagine it would be any different.

One thing I recommend is to do a clean rebuild when you compile for a platform different from the one you started on. Otherwise you can get all kinds of linker errors.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Cross-platform targeting
« Reply #3 on: February 23, 2011, 12:39:46 pm »
Work in Linux I would say, it will make it easier to avoid mistakes where you write platform specific code. MinGW is a Linux environment on Windows which code::blocks uses by default, but it still let's you do Windows stuff in it without you maybe even realizing it. While if you would by mistake write something that is Linux specific, MinGW would wrap that around for you to fit into Windows.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Svenstaro

  • Full Member
  • ***
  • Posts: 222
    • View Profile
Cross-platform targeting
« Reply #4 on: February 23, 2011, 03:09:19 pm »
Actually, cygwin is a Linux environment while MinGW is merely GCC in a Windows environment. Needless to say, I would recommend working in native Linux as it is easiest to develop in. You have all kinds of development packages and libraries at your fingertips.

In Windows and Mac OSX, you usually need to compile these manually and all of their deps as well.

 

anything