0

I have configured a build system for C and C++ code with the following configuration file stored as C++.sublime-build.

{ "cmd": ["gcc.exe", "-static", "-o", "$file_base_name", "$file"], "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", "working_dir": "$file_path", "selector": "source.c, source.c++", "shell": true } 

When I build a simple C file from Sublime, in the status bar "Building" appears for some 3 seconds and the output panel opens but remains empty. "Building" finally disappears in the status bar, but no .exe file is created. My system PATH settings are correct.

When I run the same command manually from the command line, it works like a charm:

gcc -static -o test test.c 

test.exe is created immediately. What is wrong with my Build System configuration?

1 Answer 1

1

In the "cmd" line, you may try using gcc instead of gcc.exe. The following is my build system on windows, works fine.

{ "cmd": ["gcc","-Wall", "-Wextra", "-std=c99", "${file}"], "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", "working_dir": "${file_path}", "selector": "source.c", "variants": [ { "name": "Run", "cmd": ["bash", "-c", "gcc -Wall -Wextra -std=c99 '${file}' & '${file_path}/a'"] }, { "name": "Run < txt", "cmd": ["bash", "-c", "gcc -Wall -Wextra -std=c99 '${file}' & '${file_path}/a' < '${file_base_name}'.txt"] }, { "name": "Run 4 Macro", "cmd": ["bash", "-c", "gcc -E '${file}'"] } ] } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.