Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6653273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:14:55+00:00 2026-05-26T01:14:55+00:00

If I compile a cross-platform piece of code into an object file, will it

  • 0

If I compile a cross-platform piece of code into an object file, will it be possible to use the linker to create separate platform-dependent executables (.exe,.bin) from that single binary file?

EDIT: It seems the answerers don’t really understand my question. I’m asking if you can use a cross-platform object and generate platform-dependent executables from that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:14:55+00:00Added an answer on May 26, 2026 at 1:14 am

    That pretty much depends entirely on the linker and other development tools that you have. Certainly cross compilation is possible in an advanced environment like gcc, where you can generate object code for different architectures.

    But packaging all those different-architecture objects into a single executable is not something I’ve ever seen done in gcc.

    I’ve seen fat binaries on the Apple platforms (where an executable would run on the old 68K Macs or the newer PowerPC ones) but I’ve never really been a big fan of them and Apple was in total control of the environment there.

    In addition, the loader code (part of the OS usually) has to be able to detect which architecture it should extract and run from such a fat binary (this is where Apple’s control came in handy – they could modify their various operating systems to detect and load the correct version).

    Personally, I think you’d either be better off using a portable language (Java, Perl, Python et al) or packaging your application into different binaries – you could always use one of the excellent cross-platform installation toolkits to install the correct version.


    Based on your edit clarifying the question: yes. If the object files are truly cross-platform, they will work on all those platforms. So, by definition, you can construct a platform-specific executable based on that. Note that this is not the same as compiling some cross-platform source code since the compilation process itself will most likely lock it to a specific platform.

    And, again, it depends on the tool chain being used (compiler, linker, loader, etc).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why do Actionscript, Java, C#, etc. compile into intermediate code? I'm aware of cross-platform
I've been looking into writing a small cross-platform OpenGL/helper code that can compile on
I'm writing a cross-platform code, which should compile at linux, windows, Mac OS. On
One of our projects is a cross-platform piece of code. We build it on
Possible Duplicate: Cross platform programming I've written some code using wxwidgets in c++. But
In what measure is developing with mono cross-platform? How do I compile for Windows
I'm writing an cross-platform renderer. I want to use it on Windows, Linux, Android,
Is there any way I can cross-compile C/C++ code for Windows (XP, Vista, Win7),
I've making a shared library (cross-platform), but when trying to compile the Windows build
I'd like to look into the possibility of building a (cross-platform) library (no UI)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.