Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?

Kompilacja kodu z polskimi robaczkami

Ostatnio zmodyfikowano 2009-11-02 15:23
Autor Wiadomość
mgoclo
Temat założony przez niniejszego użytkownika
Kompilacja kodu z polskimi robaczkami
» 2009-11-01 23:29:01
Hi
Mam problem z pierwszym przykładem z rozdziału 20.1 Referencje - zawierającym polskie znaki diakrytyczne. W żaden sposób nie mogę skompilować programu przykładowego. Nie ma znaczenia jaki sposób kodowania narzucę w edytorze, dla kompilatora ten kod nie jest strawny.

PS
Używam Code::Blocks 8.02. W ustawieniach kompilatora niczego nie znalazłem
Przeszukałem forum ale też niczego nie znalazłem.
P-11222
Patzick
» 2009-11-01 23:35:52
a co wyskakuje gdy próbujesz skompilować? Bo ja wrzuciłem jak jest i bez problemu skompilowało :)
P-11223
DejaVu
» 2009-11-01 23:42:44
U mnie też się skompilował.
P-11224
mgoclo
Temat założony przez niniejszego użytkownika
Kłopoty z kompilacją w obecności polskich znaków cd.
» 2009-11-02 00:46:41
Plik mam zapisany jako UTF-8. Takie same problemy występują z przykładami w postach z przed dwóch lat.
C/C++
--------------Build: Debug in Start---------------
Compiling: main.cpp
C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp: 51: 18: warning: multi - character character constant
C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp: 53: 26: warning: multi - character character constant
C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp: In function ` void Algorytm( std::string &, short int &, int & ) ':
C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 64
    : warning
    : int format
    , different type arg( arg 3 ) C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 111
    : 12
    : warning
    : multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : In function ` std::string PL( std::string & ) ': C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 111
    : warning
    : overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 115
    : 12
    : warning
    : multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 115
    : warning
    : overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 119
    : 12
    : warning
    : multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 119
    : warning
    : overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 123
    : 12
    : warning
    : multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 123
    : warning
    : overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 127
    : 12
    : warning
    : multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 127
    : warning
    : overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 131
    : 12
    : warning
    : multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 131
    : warning
    : overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 135
    : 12
    : warning
    : multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 135
    : warning
    : overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 139
    : 12
    : warning
    : multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 139
    : warning
    : overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 143
    : 12
    : warning
    : multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 143
    : warning
    : overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 147
    : 12
    : warning
    : multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 147
    : warning
    : overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
    : 147
    : error
    : duplicate case value C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 127
: error
: previously used here C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 151
: 12
: warning
: multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 151
: warning
: overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 155
: 12
: warning
: multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 155
: warning
: overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 159
: 12
: warning
: multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 159
: warning
: overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 163
: 12
: warning
: multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 163
: warning
: overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 167
: 12
: warning
: multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 167
: warning
: overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 171
: 12
: warning
: multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 171
: warning
: overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 175
: 12
: warning
: multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 175
: warning
: overflow in implicit constant conversion C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 179
: 12
: warning
: multi - character character constant C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp
: 179
: warning
: overflow in implicit constant conversion Process terminated with status 1( 0 minutes, 1 seconds ) 2 errors
    , 39 warnings Zawarto ś ć sekcji "Build messages" ||=== Start
    , Debug ===| C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 51 | warning
    : multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 53 | warning
    : multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp || In function ` void Algorytm( std::string &, short int &, int & ) ':| C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 64 | warning
    : int format
    , different type arg( arg 3 ) | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 111 | warning
    : multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp || In function ` std::string PL( std::string & ) ':| C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 111 | warning
    : overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 115 | warning
    : multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 115 | warning
    : overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 119 | warning
    : multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 119 | warning
    : overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 123 | warning
    : multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 123 | warning
    : overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 127 | warning
    : multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 127 | warning
    : overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 131 | warning
    : multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 131 | warning
    : overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 135 | warning
    : multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 135 | warning
    : overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 139 | warning
    : multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 139 | warning
    : overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 143 | warning
    : multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 143 | warning
    : overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 147 | warning
    : multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 147 | warning
    : overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 147 | error
    : duplicate case value | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 127 | error
: previously used here | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 151 | warning
: multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 151 | warning
: overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 155 | warning
: multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 155 | warning
: overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 159 | warning
: multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 159 | warning
: overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 163 | warning
: multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 163 | warning
: overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 167 | warning
: multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 167 | warning
: overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 171 | warning
: multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 171 | warning
: overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 175 | warning
: multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 175 | warning
: overflow in implicit constant conversion | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 179 | warning
: multi - character character constant | C:\D ocuments and Settings\admin\My Documents\CPP\Start\main.cpp | 179 | warning
: overflow in implicit constant conversion | ||=== Build finished
: 2 errors
    , 39 warnings ===|
PS Używam XP oryginalnego dla IBM-a.
P-11225
DejaVu
» 2009-11-02 14:02:41
Nie używaj kodowania UTF-8. Błędy które dostajesz wynikają z tego, że chcesz wyszukać polski znak. Polski znak w kodowaniu UTF-8 zajmuje 2 bajty. Kompilator więc krzyczy, że 'xx' to jest ciąg znaków, a nie jeden znak. Jeśli koniecznie chcesz wyszukiwać coś w tekście UTF-8 musisz użyć zapisu z podwójnymi apostrofami, tj. "xx", gdzie za xx możesz wstawić dowolny tekst. Co do polskich znaków w konsoli to: http://forum.ddt.pl/?Tid=282.

Jakiś wywód możesz jeszcze znaleźć na stronie: http://forum.dobreprogramy.pl/kompilacja-polskie-znaki-konsoli-t304295-15.html#p2125883
P-11228
mgoclo
Temat założony przez niniejszego użytkownika
Czyli powinienem używać starego kodowania np 1250?
» 2009-11-02 14:53:51
Sądziłem, że jeśli kopiuję przykład bezpośrednio ze strony to jeśli kopiowanie przebiegło pomyślnie to powinienem otrzymać dokładnie to co na przykładzie. Jak były kodowane przykłady z kursu? Czy podczas kodowanie doszło do jakiejś ukrytej konwersji?
P-11229
Elaine
» 2009-11-02 15:09:58
fail
P-11230
DejaVu
» 2009-11-02 15:23:18
Cały serwis jest napisany w oparciu o kodowanie UTF-8, więc być może kopiując do Code::Blocks'a ustawił kodowanie UTF-8. Kodowanie pliku można zmienić w Edit/File encoding.
P-11232
« 1 »
  Strona 1 z 1