Home Download Buy Blog Forum Support

C++ problem

C++ problem

Postby Creck on Thu Jun 28, 2012 8:32 am

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 :
Code: Select all
[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
Creck
 
Posts: 2
Joined: Thu Jun 28, 2012 8:23 am

Re: C++ problem

Postby thekyz on Thu Jun 28, 2012 10:32 am

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.
thekyz
 
Posts: 20
Joined: Fri Feb 04, 2011 9:27 am

Re: C++ problem

Postby Creck on Thu Jun 28, 2012 11:28 am

thanks for reply thekyz, but still got the same error :/
however, here is the code which I am trying to run, hope it's written well...
Code: Select all
#include <iostream>

using namespace std;

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

   return 0;
}
Creck
 
Posts: 2
Joined: Thu Jun 28, 2012 8:23 am

Re: C++ problem

Postby thekyz on Thu Jun 28, 2012 1:37 pm

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:
Code: Select all
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:

Code: Select all
#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
thekyz
 
Posts: 20
Joined: Fri Feb 04, 2011 9:27 am

Re: C++ problem

Postby Arkandias on Thu Jul 11, 2013 11:08 pm

thekyz wrote: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.


It worked for me!
Thanks you so much!
Arkandias
 
Posts: 1
Joined: Thu Jul 11, 2013 11:07 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 18 guests