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 4108296
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:38:07+00:00 2026-05-20T21:38:07+00:00

I want to create a cross-platform installer, in c++. It can be any compression

  • 0

I want to create a cross-platform installer, in c++. It can be any compression type, eg zip or gzip, embedded inside the program itself like an average installer. I don’t want to create many changes on different platforms, linux and windows. How do I embed and extract files to a c++ program, cross-platform?

  • 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-20T21:38:08+00:00Added an answer on May 20, 2026 at 9:38 pm

    C++ is a poor choice for a cross-platform installer, because there’s no such thing as cross-platform machine code.

    C++ code can be extremely portable, but it needs to be compiled for each platform, and then you get a distinct output executable for each platform.

    If you want to build installers for many platforms from a single source file, you can use C++. But if you want to build ONE installer that works on many platforms, you’ll need to use an interpreted or JIT-compiled language with runtime support available on all your targets. Of those, the only one likely to already be installed on a majority of computers of each platform is Java.


    Ok, assuming that you’re building many single-platform installers from machine code, this is what is needed:

    You need to get the compressed code into the program. You want to do this in a way that doesn’t affect the load time badly, nor cause compilation to take a few months. So using an initialized global array is a bad idea.

    One way is to link your data in as an additional section. There are tools to help with that, e.g. Binary to COFF converter, I’ve seen an ELF version as well, maybe this. But this might still cause the runtime library to try to lead the entire file into memory before execution begins.

    Another way is to use platform-specific resource APIs. This is efficient, but platform specific.

    The most straightforward solution is to simply append the compressed archive to your executable, then append eight more bytes with the file offset where the compressed archive begins. Unpacking is then as simple as opening the executable in read-only mode, fseek(-8, SEEK_END), reading the correct offset, then seeking to the beginning of the compressed data and passing that stream to your decompressor.


    Of course, now I find a website listing pretty much the same methods.

    And here’s a program which implements the last option, with additional ability to store multiple files. I wouldn’t recommend doing that, let the compression library take care of storing the file metadata.

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

Sidebar

Related Questions

I want to create a WCF service. What is the best design pattern to
I want to create an enum-like set of strings in a way that will
I want to create a function which will a number and the position of
I want to create a url as below http://maps.googleapis.com/maps/api/directions/json?origin=Adelaide,SA&destination=Adelaide,SA&waypoints=optimize:true|Barossa+Valley,SA|Clare,SA|Connawarra,SA|McLaren+Vale,SA&sensor=false I used the following code
I want to create links similar to the facebook feed. For example, when you
I want to create a static library kind of stuff which has to be
I want to create a multi file uploder using HTML5 and PHP5. I don't
I have a rather interesting problem, and wondered if it could be done purely
I have set up some custom symfony project-level settings in the file config/project.yml following
TLDR: I'm looking for a way to serve web resources (css, jpg, etc) from

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.