Sublime Forum

C++ problem

#1

Hi, I would like to ask you for help because I’ve read a dozen of similiar topics about c++ building problem and still can’t figure it out. I am using Windows 7 x64 and have already installed, sublime text 2, MinGW, also set PATH for minGW in system variables, but it still does not work. As I am pretty newbie, I’m probably gonna pulling my hair out because every time I try to compile the simple “Hello World” program, get this : [Decode error - output not utf-8][cmd: [u'g++', u'C:\\Users\\Kompik\\Desktop\\skuska.cpp', u'-o', u'C:\\Users\\Kompik\\Desktop/skuska']] [dir: C:\Users\Kompik\Desktop] [path: C:\Program Files\Java\jdk1.7.0_05\bin; C:\MinGW\bin] [Finished]
I am so clueless about this things, so please be patient.

Thanks. Appreciate it.

Creck

0 Likes

#2

In the console it says that there is a decoding error on your file:

  • Open your file (skuska.cpp it seems), click on File->Save with encoding->UTF-8

It should bring you to the next step.

0 Likes

#3

thanks for reply thekyz, but still got the same error :confused:
however, here is the code which I am trying to run, hope it’s written well…

[code]#include

using namespace std;

int main(void){
cout << “Hello World” << endl;
system(“pause”);

return 0;

}[/code]

0 Likes

#4

This is far-fetched but I got a similar problem because mingw would use localized versions of the error & somehow the parser would fail on accentuated characters.
Your original code displays an error when compiling because, well, “system” doest not exist in your scope:

C:\dev\tests\main.cpp: In function 'int main()': C:\dev\tests\main.cpp:7:18: error: 'system' was not declared in this scope [Finished in 0.2s with exit code 1]

Try compiling this instead:

#include <iostream>

using namespace std;

int main(void){
   cout << "Hello World" << endl;
   return 0;
}

Edit: If this works try adding/editing the environment variable LC_ALL to force english as a language for the compiler:
LC_ALL = en_US.UTF-8

0 Likes

#5

[quote=“thekyz”]In the console it says that there is a decoding error on your file:

  • Open your file (skuska.cpp it seems), click on File->Save with encoding->UTF-8

It should bring you to the next step.[/quote]

It worked for me!
Thanks you so much!

0 Likes