How to run C++ programs compiled on Windows on Linux?

Hello, this must've been the first time I have ever posted here, on this side of the forums. This is because I just got interesting in working with Linux.

OK, here's the deal. I made an application in Code::Blocks on Windows. I compiled it with GCC Compiler, MinGW to be exact. I built my project, got an executable (.exe) into bin-folder & decided to move it into Linux OS. I am using VirtualBox made by Oracle to run Linux on my laptop. I'm pretty sure it is reliable in terms of testing all kinds of stuff on Linux.

However, I can't run my application (.exe) on Linux. My application is called Bobby (yeah, creative), so I tried executing it from Terminal this way:

./Bobby.exe

But when I try to do this, it says:

bash: ./Bobby.exe: Permission denied


What am I doing wrong? I tried renaming Bobby.exe to Bobby.app, but it won't execute at all.

I guess because I compiled my application on Windows it might have some Windows-specific configurations. My goal is to make my application as portable as possible, so I haven't used anything non-cross-platform to my knowledge yet. All my program does is setting up a window made using OpenGL & GLFW. They are cross-platform, right?
You need to compile the program on Linux to produce a Linux specific executable.
OK, understandable. But is there any way to get USB drives work in virtual way? I can't seem to get USB work in VirtualBox & Linux.
Last edited on
closed account (Gz64jE8b)
Try running it under Wine.
You need to give a file execute rights (chmod +x) before you can run it as a program.
And yes, you still need to have Wine installed if you want to run Windows executables.
Some libraries can be usen both in Window$ and Linux. For example DirectX can't be used (AFAIK) in Linux (withouth Wine). OpenGL is library that can be used in both of systems said before ;)
Topic archived. No new replies allowed.