How to compile executable for Windows with GCC with Linux Subsystem?
Linux Subsystem works as a Linux-computer. You can only run Linux executables inside it and default gcc
creates Linux executables.
To create Windows executables, you need to install mingw cross-compiler:
sudo apt-get install mingw-w64
Then you can create 32-bit Windows executable with:
i686-w64-mingw32-gcc -o main32.exe main.c
And 64-bit Windows executable with:
x86_64-w64-mingw32-gcc -o main64.exe main.c
Note that these Windows executables will not work inside Linux Subsystem, only outside of it.
How to compile and run C in sublime text 3?
Have you tried just writing out the whole command in a single string?
{
"cmd" : ["gcc $file_name -o ${file_base_name} && ./${file_base_name}"],
"selector" : "source.c",
"shell": true,
"working_dir" : "$file_path"
}
I believe (semi-speculation here), that ST3 takes the first argument as the "program" and passes the other strings in as "arguments". https://docs.python.org/2/library/subprocess.html#subprocess.Popen
Related Topics
Why Does Zookeeper Not Use My Log4J.Properties File Log Directory
Linux Shared Library That Uses a Shared Library Undefined Symbol
How to Use Variables in a Bash for Loop
Linux's Thread Local Storage Implementation
Postgresql -Bash: Psql: Command Not Found
Delete the First Five Characters on Any Line of a Text File in Linux with Sed
How Are Sbrk/Brk Implemented in Linux
Exclude List of Files from Find
What's the Accepted Method for Deploying a Linux Application That Relies on Shared Libraries
Execute Shell Commands from Program Running in Wine
How to Simulate a Failed Disk During Testing
How to Get Started Writing a Compositing Wm
Bash Script Read All the Files in Directory
How to Write Linux Driver Module Call/Use Another Driver Module