Sublime Forum

How to run the program

#1

Hi,
I am new to coding. I am using Mac OSX Mountaion Lion. To start off I have decided to use Sublime text 2. It is great with a beautiful interface. However, I am having a little problem. I wrote a simple program using C language. How do i run the program and see how it works?

I am using Sublime Text 2.

Thanks

0 Likes

#2

Did you try Tools>Build?

0 Likes

#3

I wrote this code,

[code]#include <stdio.h>

int main()
{
printf(“Hello world\n”);
return 0;
}[/code]

I went to Tools -> Built. Then came this message.

"/Users/mohamedsuhail/Desktop/program.c:1:19: error: stdio.h: No such file or directory /Users/mohamedsuhail/Desktop/program.c: In function 'int main()': /Users/mohamedsuhail/Desktop/program.c:5: error: 'printf' was not declared in this scope [Finished in 0.0s with exit code 1]"

0 Likes

#4

Someone please help so i can continue using Sublime Text 2 for C. I don’t want to use another program. :neutral_face:

0 Likes

#5

This isn’t a problem with Sublime Text, it’s your development setup that’s incomplete.

For OSX, you need XCode installed, then run xcode-select --install to install everything needed.

0 Likes

#6

You could use Sublime Text’s build system, but I wouldn’t recommend it until you learn your way around the command line. To build, cd into your source directory and use cc -o program program.c

0 Likes

#7

I am a JavaScript programmer. I use sublime text. And I already have Xcode installed. But how do I run a project. Please I need help!

0 Likes

#8

Hello
Can anyone assist me how to run c program on windows on sublime text 3?

0 Likes

#9

i fell in love with sublime so i decided to use it for some school c++ projects. This video explains how to use C and C++ perfectly and it worked for me. I just messed a little with what i learned here and worked gr8!

video: https://www.youtube.com/watch?v=XjkT-Ng5LYQ

maybe this post will help others, if this was to late sorry!

0 Likes

#10

Hello, I believe that´s your problem. You wrote printf(“Hello World”), you are supposed to write print(“Hello World”), the extra “f” is not letting your program run because it´s wrong. The error which shows up says the exact same thing, printf is supposed to be written print. Hope it helps.

0 Likes

#11

Hello, I am new to Coding.I am not able to see anything after the build is done on google chrome

0 Likes