-2

I'm new to Sublime Text 2 text editor and I have these code saved as .cpp, using C obviously, but it won't build?

#include <stdio.h>
#include <conio.h>

int main()
{
    printf("Hello World!");
    return 0;
}

It displays:

'g++' is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.1s with exit code 1]
[shell_cmd: g++ "C:\Users\KrizMalchael\Desktop\hello.cpp" -o "C:\Users\KrizMalchael\Desktop/hello"]
[dir: C:\Users\KrizMalchael\Desktop]
[path: C:\Program Files\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Broadcom\Broadcom 802.11 Network Adapter\Driver;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\]
Rapptz
  • 20,807
  • 5
  • 72
  • 86
android17
  • 1
  • 1
  • 6
    .cpp is a file extension for C++ -- not C. Also the error means that you don't have g++ in your path. – Rapptz Jul 03 '14 at 02:38

1 Answers1

0

You are trying to build a C program but you have named your file as a C++ prgram. Change your file extension to .c. Also you may need to do some set up to get sublime text to build programs under windows. There is a question about that here: How do I compile and run a C program in Sublime Text 2?.

Community
  • 1
  • 1
Fantastic Mr Fox
  • 32,495
  • 27
  • 95
  • 175