Selected language error

Asked

Viewed 57 times

1

I copied a source code made in the program Code Blocks and pasted it in a project in Visual Studio C 2010 Express, compiled and is giving some errors, one of the errors is in this line:

int main(){

// Altera a linguagem do console para permitir acentos
setlocale(LC_ALL, "Portuguese"); //Erro

error:Error 2 error C3861: 'setlocale': identifier not found

2 answers

1

I put this statement and the error is gone.

#include <clocale>

Agree?

  • 2

    Yes. setlocale is a native C function present in the library locale. You will need to do the include of the same, as you put in this reply.

0

As cited by the user, the problem can be solved with include de clocale:

#include <clocale>

  • 1

    Then I added this line in the header and the error disappeared: #include <clocale> this is good practice?

  • I added this line that you gave in response and removed the #include <clocale> and the error appeared again, I believe it is lack of the include.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.