Łakasabasz Temat założony przez niniejszego użytkownika |
Code::Blocks i autouzupełnianie » 2017-09-25 18:04:20 Witam,
Mam problem z C::B. Nie jest to problem uniemożliwiający programowanie, ale znacząco je uprzykrza. Chodzi o auto-uzupełnianie. Mechanizm kompletnie się gubi w nagłówkach przy kompilatorze MinGW w wersji 6.3, np. nie wyświetla mi niczego w przestrzeni nazw std::. Poprawia mu się gdy dodam odpowiednią ścieżkę w ustawieniach projektu, ale przy próbie kompilacji to MinGW się wścieka że ma problem ze skompilowaniem kodu. W starszych wersjach MinGW nie ma takich problemów (w szkole mamy wersję 13 (C::B) z "wbudowanym" kompilatorem w wersji 4). Na internecie pisało, że robił tak już wcześniej przy starych wersjach i pomagała aktualizacja, ale w takim wypadku do czego mam zaktualizować? Myślałem też nad tym aby na stałe wpisać skrypt do tego pluginu, ale nie wiem gdzie go znaleźć i czy w ogóle da się coś takiego zrobić. Jeżeli ktoś miał (lub ma) taki problem to proszę o odpowiedź.
C::B mam w wersji 16.01.
P.S. Nie wiem jakich informacji jeszcze udzielić, bo pierwszy raz spotkałem się z błędem środowiska. |
|
jankowalski25 |
» 2017-09-25 18:09:53 Jak dodajesz ścieżkę? |
|
Łakasabasz Temat założony przez niniejszego użytkownika |
» 2017-09-25 18:15:30 Standardowo, tak jak się podpina inną bibliotekę do przeszukiwanych katalogów. Projekt XYZ -> Build Options -> XYZ -> Search Directories -> Compiler |
|
jankowalski25 |
» 2017-09-25 20:39:18 Czy na pewno jest ustawiona poprawnie? Jak wyglądają logi kompilacji? |
|
Łakasabasz Temat założony przez niniejszego użytkownika |
» 2017-09-29 16:48:03 Przepraszam, że nie odpisałem wcześniej. Ta ścieżka prowadzi głęboko w drzewo include do miejsca zapisu pliku iostream. Kod programu #include <iostream>
using namespace std;
int main() { cout << "Program pisany wyłącznie pod post" << endl; } Logi kompilacji (bez dodania ścieżki - auto uzupełnianie nie działa): -------------- Build: Debug in 0temp (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -g -Wnon-virtual-dtor -Wshadow -Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Winline -Wunreachable-code -Wmissing-declarations -Wswitch-enum -Wswitch-default -Wextra -Wall -std=c++14 -IE:\MyLib\include -IG:\utilitis\wxWidgets-3.0.3\include -c G:\projekty\C++\0temp\main.cpp -o obj\Debug\main.o mingw32-g++.exe -LG:\utilitis\wxWidgets-3.0.3\lib\gcc_lib -o bin\Debug\0temp.exe obj\Debug\main.o -static -static-libgcc Output file is bin\Debug\0temp.exe with size 2.06 MB Process terminated with status 0 (0 minute(s), 5 second(s)) 0 error(s), 0 warning(s) (0 minute(s), 5 second(s))
Log po dodaniu ścieżki do projektu (auto uzupełnianie działa): mingw32-g++.exe -Wall -g -Wnon-virtual-dtor -Wshadow -Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Winline -Wunreachable-code -Wmissing-declarations -Wswitch-enum -Wswitch-default -Wextra -Wall -std=c++14 -I..\..\..\utilitis\MinGW\include\c++\3.4.5 -I..\..\..\utilitis\MinGW\include\c++\3.4.5\mingw32 -I..\..\..\utilitis\MinGW\include -IE:\MyLib\include -IG:\utilitis\wxWidgets-3.0.3\include -c G:\projekty\C++\0temp\main.cpp -o obj\Debug\main.o mingw32-g++.exe -LG:\utilitis\wxWidgets-3.0.3\lib\gcc_lib -o bin\Debug\0temp.exe obj\Debug\main.o -static -static-libgcc In file included from g:\utilitis\mingw\include\c++\3.4.5\bits\postypes.h:46:0, from g:\utilitis\mingw\include\c++\3.4.5\iosfwd:50, from g:\utilitis\mingw\include\c++\3.4.5\ios:44, from g:\utilitis\mingw\include\c++\3.4.5\ostream:45, from g:\utilitis\mingw\include\c++\3.4.5\iostream:45, from G:\projekty\C++\0temp\main.cpp:1: g:\utilitis\mingw\include\c++\3.4.5\cwchar:161:11: error: '::swprintf' has not been declared using ::swprintf; ^~~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cwchar:168:11: error: '::vswprintf' has not been declared using ::vswprintf; ^~~~~~~~~ In file included from g:\utilitis\mingw\include\c++\3.4.5\cstdlib:52:0, from g:\utilitis\mingw\include\c++\3.4.5\bits\stl_algobase.h:67, from g:\utilitis\mingw\include\c++\3.4.5\bits\char_traits.h:46, from g:\utilitis\mingw\include\c++\3.4.5\ios:46, from g:\utilitis\mingw\include\c++\3.4.5\ostream:45, from g:\utilitis\mingw\include\c++\3.4.5\iostream:45, from G:\projekty\C++\0temp\main.cpp:1: g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:38:12: error: 'std::abort' has not been declared using std::abort; ^~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:39:12: error: 'std::atexit' has not been declared using std::atexit; ^~~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:40:12: error: 'std::exit' has not been declared using std::exit; ^~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:51:12: error: 'std::div_t' has not been declared using std::div_t; ^~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:52:12: error: 'std::ldiv_t' has not been declared using std::ldiv_t; ^~~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:54:12: error: 'std::abs' has not been declared using std::abs; ^~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:55:12: error: 'std::atof' has not been declared using std::atof; ^~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:56:12: error: 'std::atoi' has not been declared using std::atoi; ^~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:57:12: error: 'std::atol' has not been declared using std::atol; ^~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:58:12: error: 'std::bsearch' has not been declared using std::bsearch; ^~~~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:59:12: error: 'std::calloc' has not been declared using std::calloc; ^~~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:60:12: error: 'std::div' has not been declared using std::div; ^~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:61:12: error: 'std::free' has not been declared using std::free; ^~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:62:12: error: 'std::getenv' has not been declared using std::getenv; ^~~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:63:12: error: 'std::labs' has not been declared using std::labs; ^~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:64:12: error: 'std::ldiv' has not been declared using std::ldiv; ^~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:65:12: error: 'std::malloc' has not been declared using std::malloc; ^~~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:67:12: error: 'std::mblen' has not been declared using std::mblen; ^~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:68:12: error: 'std::mbstowcs' has not been declared using std::mbstowcs; ^~~~~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:69:12: error: 'std::mbtowc' has not been declared using std::mbtowc; ^~~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:71:12: error: 'std::qsort' has not been declared using std::qsort; ^~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:72:12: error: 'std::rand' has not been declared using std::rand; ^~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:73:12: error: 'std::realloc' has not been declared using std::realloc; ^~~~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:74:12: error: 'std::srand' has not been declared using std::srand; ^~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:75:12: error: 'std::strtod' has not been declared using std::strtod; ^~~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:76:12: error: 'std::strtol' has not been declared using std::strtol; ^~~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:77:12: error: 'std::strtoul' has not been declared using std::strtoul; ^~~~~~~ g:\utilitis\mingw\lib\gcc\mingw32\6.3.0\include\c++\stdlib.h:78:12: error: 'std::system' has not been declared using std::system; ^~~~~~ In file included from g:\utilitis\mingw\include\c++\3.4.5\bits\stl_algobase.h:67:0, from g:\utilitis\mingw\include\c++\3.4.5\bits\char_traits.h:46, from g:\utilitis\mingw\include\c++\3.4.5\ios:46, from g:\utilitis\mingw\include\c++\3.4.5\ostream:45, from g:\utilitis\mingw\include\c++\3.4.5\iostream:45, from G:\projekty\C++\0temp\main.cpp:1: g:\utilitis\mingw\include\c++\3.4.5\cstdlib:86:11: error: '::div_t' has not been declared using ::div_t; ^~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:87:11: error: '::ldiv_t' has not been declared using ::ldiv_t; ^~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:89:11: error: '::abort' has not been declared using ::abort; ^~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:90:11: error: '::abs' has not been declared using ::abs; ^~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:91:11: error: '::atexit' has not been declared using ::atexit; ^~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:92:11: error: '::atof' has not been declared using ::atof; ^~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:93:11: error: '::atoi' has not been declared using ::atoi; ^~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:94:11: error: '::atol' has not been declared using ::atol; ^~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:95:11: error: '::bsearch' has not been declared using ::bsearch; ^~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:96:11: error: '::calloc' has not been declared using ::calloc; ^~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:97:11: error: '::div' has not been declared using ::div; ^~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:98:11: error: '::exit' has not been declared using ::exit; ^~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:99:11: error: '::free' has not been declared using ::free; ^~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:100:11: error: '::getenv' has not been declared using ::getenv; ^~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:101:11: error: '::labs' has not been declared using ::labs; ^~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:102:11: error: '::ldiv' has not been declared using ::ldiv; ^~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:103:11: error: '::malloc' has not been declared using ::malloc; ^~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:105:11: error: '::mblen' has not been declared using ::mblen; ^~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:106:11: error: '::mbstowcs' has not been declared using ::mbstowcs; ^~~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:107:11: error: '::mbtowc' has not been declared using ::mbtowc; ^~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:109:11: error: '::qsort' has not been declared using ::qsort; ^~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:110:11: error: '::rand' has not been declared using ::rand; ^~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:111:11: error: '::realloc' has not been declared using ::realloc; ^~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:112:11: error: '::srand' has not been declared using ::srand; ^~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:113:11: error: '::strtod' has not been declared using ::strtod; ^~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:114:11: error: '::strtol' has not been declared using ::strtol; ^~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:115:11: error: '::strtoul' has not been declared using ::strtoul; ^~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:116:11: error: '::system' has not been declared using ::system; ^~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib: In function 'long int std::abs(long int)': g:\utilitis\mingw\include\c++\3.4.5\cstdlib:123:34: error: 'labs' was not declared in this scope abs(long __i) { return labs(__i); } ^ g:\utilitis\mingw\include\c++\3.4.5\cstdlib: At global scope: g:\utilitis\mingw\include\c++\3.4.5\cstdlib:125:10: error: 'ldiv_t' does not name a type inline ldiv_t ^~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:143:11: error: '::lldiv_t' has not been declared using ::lldiv_t; ^~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:149:11: error: '::_Exit' has not been declared using ::_Exit; ^~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:159:10: error: 'lldiv_t' does not name a type inline lldiv_t ^~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:163:10: error: 'lldiv_t' does not name a type inline lldiv_t ^~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:176:11: error: '::atoll' has not been declared using ::atoll; ^~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:177:11: error: '::strtoll' has not been declared using ::strtoll; ^~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:178:11: error: '::strtoull' has not been declared using ::strtoull; ^~~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:180:11: error: '::strtof' has not been declared using ::strtof; ^~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:181:11: error: '::strtold' has not been declared using ::strtold; ^~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:187:20: error: '__gnu_cxx::lldiv_t' has not been declared using __gnu_cxx::lldiv_t; ^~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:189:20: error: '__gnu_cxx::_Exit' has not been declared using __gnu_cxx::_Exit; ^~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:193:20: error: '__gnu_cxx::div' has not been declared using __gnu_cxx::div; ^~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:194:20: error: '__gnu_cxx::lldiv' has not been declared using __gnu_cxx::lldiv; ^~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:196:20: error: '__gnu_cxx::atoll' has not been declared using __gnu_cxx::atoll; ^~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:197:20: error: '__gnu_cxx::strtof' has not been declared using __gnu_cxx::strtof; ^~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:198:20: error: '__gnu_cxx::strtoll' has not been declared using __gnu_cxx::strtoll; ^~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:199:20: error: '__gnu_cxx::strtoull' has not been declared using __gnu_cxx::strtoull; ^~~~~~~~ g:\utilitis\mingw\include\c++\3.4.5\cstdlib:200:20: error: '__gnu_cxx::strtold' has not been declared using __gnu_cxx::strtold; ^~~~~~~ In file included from g:\utilitis\mingw\include\c++\3.4.5\algorithm:69:0, from g:\utilitis\mingw\include\c++\3.4.5\string:56, from g:\utilitis\mingw\include\c++\3.4.5\bits\locale_classes.h:47, from g:\utilitis\mingw\include\c++\3.4.5\bits\ios_base.h:47, from g:\utilitis\mingw\include\c++\3.4.5\ios:49, from g:\utilitis\mingw\include\c++\3.4.5\ostream:45, from g:\utilitis\mingw\include\c++\3.4.5\iostream:45, from G:\projekty\C++\0temp\main.cpp:1: g:\utilitis\mingw\include\c++\3.4.5\bits\stl_algo.h: In function 'void std::random_shuffle(_RandomAccessIterator, _RandomAccessIterator)': g:\utilitis\mingw\include\c++\3.4.5\bits\stl_algo.h:1746:35: error: 'rand' is not a member of 'std' std::iter_swap(__i, __first + (std::rand() % ((__i - __first) + 1))); ^~~ Process terminated with status 1 (0 minute(s), 2 second(s)) 79 error(s), 0 warning(s) (0 minute(s), 2 second(s)) |
|
jankowalski25 |
» 2017-09-29 17:54:36 -I..\..\..\utilitis\MinGW\include\c++\3.4.5 -I..\..\..\utilitis\MinGW\include\c++\3.4.5\mingw32 -I..\..\..\utilitis\MinGW\include |
Spróbuj dodać ścieżki jako bezwzględne, a nie względne. A tak w ogóle to gdzie je wstawiasz? Globalnie czy tylko dla aktualnego projektu? Bo jeśli globalnie, to jak inny projekt będzie inaczej umieszczony w drzewie plików i folderów lub znajdzie się na innym dysku, to nagle ścieżki względne mogą przestać działać. Poza tym, upewnij się, że ścieżka prowadzi do właściwych nagłówków. Bo jeśli trafisz w pliki przeznaczone dla języka C (albo w jakieś pliki pomocnicze), to mogą się pojawić błędy związane chociażby z przestrzenią nazw std. Dopisano:Zresztą, w razie potrzeby możesz sprawdzić, jakie ścieżki są domyślnie przeszukiwane, na przykład zgodnie z http://mingw.org/wiki/IncludePathHOWTO. Inna sprawa, że sam plugin obsługujący autouzupełnianie jest nadal niedopracowany. |
|
Łakasabasz Temat założony przez niniejszego użytkownika |
» 2017-09-29 18:28:21 Te ścieżki są wpisane tylko dla tego jednego projektu, ale nawet jeżeli by były w innym projekcie i tak wywalały mi błędy. Ścieżek pełnych też próbowałem z tym samym efektem. Ścieżka ..\..\..\utilitis\MinGW\include\c++\3.4.5 prowadzi bezpośrednio do katalogu z plikami takimi jak iostream, vector, map, itd.
Czytałem, że w nowej wersji MinGW została przeprogramowana implementacja m.in strumieni, z drugiej jednak strony w całym katalogu include jest tylko jeden plik iostream.
EDIT: Użyłem wszystkich kombinacji ze ścieżkami domyślnego przeszukiwania, ale nadal nie działa. Może to już nie aktualne? |
|
jankowalski25 |
» 2017-10-01 12:48:18 Settings -> Editor -> Code completion -> C/C++ parser (adv.) |
Sprawdź, czy tutaj masz wszystko ustawione poprawnie (rozszerzenia nagłówków, rozszerzenia plików źródłowych i dołączanie plików bez rozszerzeń). Na podstawie tego jest tworzona lista plików do przejrzenia, więc może tu jest coś nie tak. |
|
« 1 » 2 |