2

I have a really easy code using C++ with Gtkmm :

#include <gtkmm.h>

int main(int argc, char *argv[]){
Gtk::Main app(argc, argv);
Gtk::Window window;
Gtk::Main::run(window);
return EXIT_SUCCESS;
}

I compile this on Linux and It is perfect I can execute it. But the problem is when I copy past the executable I don't achieve to make workable on Windows. But I always think Gtkmm is portable.

How can I solve this problem?

1
  • 8
    the library can be used to build code for different platforms -- that doesn't mean you can copy the executable across platforms. You still need to build the program for each platform. Commented Sep 25, 2017 at 8:01

2 Answers 2

5

Gtkmm is indeed a portable implementation. Nevertheless you cannot simply copy and paste an executable from Linux to Windows. You have to compile your program once for each platform you're running it on. In your case, you have to create the typical .exe executable for Windows.

If you want to cross-compile the executable for Windows (i.e. use your Linux machine to create the .exe file for Windows), have a look at the mingw compiler toolchain. This blog might also have some interesting information for you.

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you but I heard it was not easy at all to compile gtkmm3 with Windows... :/
It is not, which is why you should get a pre-compiled gtkmm3 to link against when you cross-compile.
How can I have a pre-compiled gtkmm3 ? :)
@VickyHarris google is your friemd: wiki.gnome.org/Projects/gtkmm/MSWindows
1

It is because executables on Linux and Windows have different structures:
On Linux, you have ELF binaries, which do not work on Windows. Similarly, if you take an EXE binary from Windows and try to execute it on a Linux machine, it will not work.

See ELF and EXE for more information.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.