1

I am writing a c++ program specifically for Windows operating system. However, I am writing it on a Mac OS. I know it seems counter productive, but I have my reasons that would take the next paragraph to explain. What I want is to be able to compile it on my Mac, and turn it into a .exe file, but I won't be running it on a Mac. I'll be running it on a Windows machine. The header that I want to use, but I obviously have problems with is windows.h. Using the standard g++ on a Mac I am unable to do this.

However, winegcc using wineg++ is able to do this. I have seen that you are able to install these on a Linux machine. I want to know if it is possible to do on a Mac as well.

Sam Moldenha
  • 463
  • 2
  • 11

1 Answers1

2

This will allow you to import windows.h on a Mac OS, you just won't be able to run it on a Mac OS

The comment that said to install MinGW worked great. I just ran brew install mingw-w64 in terminal, then this example command worked on a mac and compiled a windows executable file:

i686-w64-mingw32-g++ shell.cpp -o shellv1.exe -lws2_32 -s -ffunction-sections -fdata-sections -Wno-write-strings -fno-exceptions -fmerge-all-constants -static-libstdc++ -static-libgcc

Sam Moldenha
  • 463
  • 2
  • 11