Thank you for your quick response and your effort!
If I try to compile the main.c file I get the following error:
Sorry for my lack of knowledge and the inconvenience.
Thank you for your quick response and your effort!
If I try to compile the main.c file I get the following error:
Sorry for my lack of knowledge and the inconvenience.
No, definitely not I’m not sure what the problem is. Your project file doesn’t seem to be highlighted correctly.
I created a folder test. Opened a new file, copied your code into it and saved it in the folder as my project.sublime-project.
After that I created main.c. Coded HelloWorld and saved it.
When I went to Tools -> Build System I couldn’t find “mybuild”. So I moved on to Tools -> Build System > New Build System and created a “mybuild.sublime-build”. Now it shows “mybuild” at Tools -> Build System.
When I select the build system and press Build I get the error as shown in the previous pics.
Right. But also open the sublime project file with Sublime. This is confusing, I know. You have to be in “project mode”, right now you are in “folder” mode. Go to Project -> Open Project and select the project file.
Thank you! It seems to work now. But when I try to compile my “HelloWorld” the Console just shows: “[Finished in 0.2s]”.
No “HelloWorld” though.
myproject.sublime-project is still not highlighted as seen in your picture either.
The build rule is just a compilation rule. So it compiles main.c into “myapp”.
To actually run your program called “myapp”, open the Terminal app, then do
$ cd Desktop
$ cd test
$ ./myapp
You could write a build system rule for that too:
"build_systems":
[
{
"file_regex": "(.+[^:]):(\\d+):(\\d+): (?:fatal )?((?:error|warning): .+)$",
"name": "mybuild",
"shell_cmd": "gcc -Wall -O2 main.c -o myapp",
"working_dir": "${project_path}"
},
{
"name": "run the executable",
"shell_cmd": "./myapp",
"working_dir": "${project_path}"
}
],
Is there any way to output a information that looks like this:
"Process terminated with status 0 (0 minute(s), 1 second(s))
0 error(s), 0 warning(s) (0 minute(s), 1 second(s))"
Try this new build system that I build for myself, It helped me to compile and execute c programs at the same time. Basically what the code does is it compiles the c program with the GCC compiler and opens the compiled c program in a new terminal.
[+] NOTE: “Works only on Linux distributions” …
[STEPS]
Install xterm if you don’t have xterm installed on your Linux system. To install xterm use
sudo apt-get install xterm
Go to Tools > Build System > New build system
Now enter this code
Save it as GCCbuildsys.sublime-build
Restart your sublime text 3 by closing it and reopening it again.
Select the build system by going to
Tools > Build System > GCCbuildsys
7.Now to compile and execute your program open up your c program and press Ctrl + b .
Hope it helps …