Hannes
Hannes

Reputation: 23

running windows C++ code on a linux cluster

My program recently got an bad_alloc error when increasing it's precision. My guess is, that it needs more RAM than my Computer can assign it (effectively more than 3GB RAM needed). So I decided to try it on our linux cluster since it can give me way more RAM. It contains some gcc modules. But I'm not sure how to use my c++ code on it. Could I just run my .exe on the cluster or should I recompile it first on the linux cluster?

Upvotes: 0

Views: 427

Answers (2)

Thomas Sablik
Thomas Sablik

Reputation: 16453

There are ways to make Windows executables run on Linux, e.g. Wine but usually you want a native Linux executable. Executables have a different file format on Windows (EXE) and on Linux (ELF).

Your options are

  • to recompile the code and run the program without other tools or
  • to use a tool, e.g. Wine, that can run Windows executables on Linux.

If your code can be compiled on a different system depends on your code. Did you use Windows libraries? Did you use third party libraries? Did you use compiler extensions?

Most third party libraries can usually be also used on Linux. For Windows-only libraries and compiler extensions you have to find a workaround.

Upvotes: 1

codegorilla
codegorilla

Reputation: 536

Well, you definitely need to recompile your code on cluster, if I understood the situation correctly. You have built your app on Windows platform, so that binary cannot work on linux target system.

Upvotes: 1

Related Questions