• Najnowsze pytania
  • Bez odpowiedzi
  • Zadaj pytanie
  • Kategorie
  • Tagi
  • Zdobyte punkty
  • Ekipa ninja
  • IRC
  • FAQ
  • Regulamin
  • Książki warte uwagi

Jaki komplikator do klepania w Cpp

Object Storage Arubacloud
0 głosów
423 wizyt
pytanie zadane 10 grudnia 2020 w C i C++ przez shaye.servando Nowicjusz (170 p.)
Witam,

Jaki według was jest najlepszy komplikator do klepania w Cpp. Waham się pomiędzy Code Bloks, a Visual Studio. Widziałem też coś typu Visual Studio Code - czy to jest wersja Visual Studio specjalnie dla programistów do kodowania? A samo Visual Studio w takim układzie do czego jest? Czytałem, że też można tam tworzyć kod.

Pozdrawiam
komentarz 10 grudnia 2020 przez tkz Nałogowiec (42,000 p.)
Bardzo mieszasz pojęcia. Twój "komplikator" nie ma nic wspólnego z wybraniem środowiska. Doczytaj czym jest IDE, czy jest kompilator, a czym jest edytor kodu.
3
komentarz 10 grudnia 2020 przez Whiskey_Taster Pasjonat (15,610 p.)

Komplikator? laugh​​​​​​

komentarz 11 grudnia 2020 przez Bun1o Obywatel (1,620 p.)

@shaye.servando,
 na początek polecam Code Blocks'a, ale pamiętaj, że to jest środowisko programistyczne (czyli właśnie wyżej wspomniane IDE)

komentarz 11 grudnia 2020 przez tkz Nałogowiec (42,000 p.)
Dlaczego polecasz Code Blocks?
komentarz 11 grudnia 2020 przez Bun1o Obywatel (1,620 p.)
Jest łatwy w obsłudze, podkreśla składnie, a do tego najczęściej wykorzystywany w szkołach (podstawowych i średnich). Nie mówię przy tym, że jest najlepszy ze wszystkich, ale mi, na początek, pasował.

4 odpowiedzi

+3 głosów
odpowiedź 11 grudnia 2020 przez tangarr Mędrzec (154,860 p.)
Jeżeli szukasz IDE do programowania to z czystym sercem mogę polecić ci dwa:
- Visual Studio (Community Edition) - posiada całkiem fajny statyczny analizator kodu + narzędzia do profilowania kodu
- QtCreator - bardzo fajne IDE obsługujące wiele kompilatorów (w tym kompilator Visual Studio). Jedną z ciekawszych funkcji jest wbudowany Clang Code Model, który wyszukuje błędy już w trakcie pisania kodu.

Nie ważne jakie IDE wybierzesz. Dużo ważniejsze jest żebyś używał nowoczesnego kompilatora dającego czytlene ostrzeżenia. I pamiętaj żeby czytać i naprawiać wszystkie ostrzeżenia kompilatora. Kompilator jest twoim przyjacielem, chce dla ciebie jak najlepiej.
1
komentarz 11 grudnia 2020 przez NewEraOfPeace Gaduła (4,790 p.)
Co z Code::Blocks? Jest dużo lżejszy niż dwa wymienione i jak ostatnio sprawdzałem, to dostał parę updateów i już ma kompilator wspierający nowsze standardy.
komentarz 11 grudnia 2020 przez tangarr Mędrzec (154,860 p.)
Z ciekawości zainstalowałem wersję 20.03-3 dostępną w moim repozytorium systemowym.
Muszę przyznać, że już wolę pisać w vimie.

Edytor kodu nie potrafi wstawiać wcięć w kodzie (prawdopodobnie przez to tak dużo początkujących programistów wrzuca na forum zupełnie niesformatowany kod). Co prawda jest wtyczka do formatowania, ale trzeba ją uruchamiać ręcznie.

Edytor praktycznie nie ma żadnych opcji refaktoryzacji kodu.

Nie posiada żadnych narzędzi do analizy kodu (być może są do tego pluginy).

Nie obsługuje projektów CMake.

Jedynym gorszym IDE, które znam jest DevC++
+1 głos
odpowiedź 11 grudnia 2020 przez Wiciorny Ekspert (270,190 p.)
Kompilator do C++ najlepiej gnu- gcc. https://gcc.gnu.org/
komentarz 11 grudnia 2020 przez tkz Nałogowiec (42,000 p.)
Dlaczego?
komentarz 11 grudnia 2020 przez Wiciorny Ekspert (270,190 p.)
bo innego nie znam  :D, a tak więcej to :
GCC ma lepsze wsparcie dla większej liczby architektur niż LLVM np . W przypadku C ++ Clang i g ++ są doskonałe, a obecnie oba mają doskonałe komunikaty o błędach (jeśli to możliwe, to powinno sie kompilować z obydwoma). Jeśli potrzeba nam jest bardzo głębokiej kontroli nad generowanym kodem, GCC może sprawdzić się do tego zdecydowanie lepiej: GCC jest starsze niż LLVM i dlatego ma kilka dodatkowych wewnętrznych i dostępnych hacków (których niby nie powinno się używać, chyba że ich naprawde potrzeba, ale jest możliwość korzystania z nich !).
komentarz 11 grudnia 2020 przez tkz Nałogowiec (42,000 p.)

Przy LLVM wszystkie kompilatory wypadają dobrze. Wybór kompilatora, to kwestia wymagań, to fakt. Czy jakikolwiek kompilator ma doskonałe komunikaty o błędach? Nie spotkałem jeszcze takiego. Pierwsze słyszę by kompilować na dwóch kompilatorach ten sam kod. 

Jeśli potrzeba nam jest bardzo głębokiej kontroli nad generowanym kodem, GCC może sprawdzić się do tego zdecydowanie lepiej:

Dlaczego? 

komentarz 11 grudnia 2020 przez tangarr Mędrzec (154,860 p.)
Trzeba jednak przyznać, że Clang zrobił dobrą robotę.
Nic tak nie pobudza jak konkurencja.
Twórcy GCC dostali kopa i naprawdę wzięli się do pracy.
komentarz 11 grudnia 2020 przez tkz Nałogowiec (42,000 p.)

 

#include <vector>
#include <algorithm>
int main()
{
    int a;
    std::vector< std::vector <int> > v;
    std::vector< std::vector <int> >::const_iterator it = std::find( v.begin(), v.end(), a );
}

 g++ --version
g++.exe (Rev5, Built by MSYS2 project) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:71,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_equals_val<_Value>::operator()(_Iterator) [with _Iterator = _vector<int>*, std::vector<std::vector<int> > >; _Value = const int]':
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:1932:14:   required from '_RandomAccessIterator std::__find_if(_RandomAccessIterator, _RandomAccessIterator, _Predr_tag) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int> > >; _Predicate = __gnu_cxx::__ops::_Iter_equals_val<cons
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:1977:23:   required from '_Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = __gnu_cxx::>*, std::vector<std::vector<int> > >; _Predicate = __gnu_cxx::__ops::_Iter_equals_val<const int>]'
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algo.h:3902:28:   required from '_IIter std::find(_IIter, _IIter, const _Tp&) [with _IIter = __gnu_cxx::__normal_iterator<stdvector<int> > >; _Tp = int]'
.\main.cc:7:92:   required from here
C:/msys64/mingw64/include/c++/10.2.0/bits/predefined_ops.h:268:17: error: no match for 'operator==' (operand types are 'std::vector<int>' and 'const int')
  268 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:67,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_iterator.h:1064:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator=tor<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)'
 1064 |     operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
      |     ^~~~~~~~
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_iterator.h:1064:5: note:   template argument deduction/substitution failed:
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:71,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/predefined_ops.h:268:17: note:   'std::vector<int>' is not derived from 'const __gnu_cxx::__normal_iterator<_IteratorL, _Containe
  268 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:67,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_iterator.h:1072:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator==(const __gnu_cxx::tainer>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)'
 1072 |     operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
      |     ^~~~~~~~
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_iterator.h:1072:5: note:   template argument deduction/substitution failed:
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:71,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/predefined_ops.h:268:17: note:   'std::vector<int>' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container
  268 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:64,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_pair.h:466:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const std::pair<_T1, _T2>&, con
  466 |     operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_pair.h:466:5: note:   template argument deduction/substitution failed:
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:71,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/predefined_ops.h:268:17: note:   'std::vector<int>' is not derived from 'const std::pair<_T1, _T2>'
  268 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:67,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_iterator.h:360:5: note: candidate: 'template<class _Iterator> bool std::operator==(const std::reverse_iterator<_Iterator>&, ctor>&)'
  360 |     operator==(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_iterator.h:360:5: note:   template argument deduction/substitution failed:
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:71,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/predefined_ops.h:268:17: note:   'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
  268 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:67,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_iterator.h:398:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator==(const std::reverse_iterrse_iterator<_IteratorR>&)'
  398 |     operator==(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_iterator.h:398:5: note:   template argument deduction/substitution failed:
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:71,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/predefined_ops.h:268:17: note:   'std::vector<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
  268 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:67,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_iterator.h:1427:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator==(const std::move_iteratiterator<_IteratorR>&)'
 1427 |     operator==(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_iterator.h:1427:5: note:   template argument deduction/substitution failed:
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:71,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/predefined_ops.h:268:17: note:   'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
  268 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
 

komentarz 11 grudnia 2020 przez tkz Nałogowiec (42,000 p.)

In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:67,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_iterator.h:1495:5: note: candidate: 'template<class _Iterator> bool std::operator==(const std::move_iterator<_IteratorL>&, co>&)'
 1495 |     operator==(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_iterator.h:1495:5: note:   template argument deduction/substitution failed:
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:71,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/predefined_ops.h:268:17: note:   'std::vector<int>' is not derived from 'const std::move_iterator<_IteratorL>'
  268 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from C:/msys64/mingw64/include/c++/10.2.0/vector:64,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/allocator.h:206:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const std::allocator<_Tp1>&, const std::
  206 |     operator==(const allocator<_T1>&, const allocator<_T2>&)
      |     ^~~~~~~~
C:/msys64/mingw64/include/c++/10.2.0/bits/allocator.h:206:5: note:   template argument deduction/substitution failed:
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:71,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/predefined_ops.h:268:17: note:   'std::vector<int>' is not derived from 'const std::allocator<_Tp1>'<_Tp1>'
  268 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from C:/msys64/mingw64/include/c++/10.2.0/vector:67,
                 from .\main.cc:1:                                                                                                     (const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)'
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_vector.h:1892:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator==(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)'
 1892 |     operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
      |     ^~~~~~~~
C:/msys64/mingw64/include/c++/10.2.0/bits/stl_vector.h:1892:5: note:   template argument deduction/substitution failed:
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:71,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:                                                                                                      int'
C:/msys64/mingw64/include/c++/10.2.0/bits/predefined_ops.h:268:17: note:   mismatched types 'const std::vector<_Tp, _Alloc>' and 'const int'
  268 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~
In file included from C:/msys64/mingw64/include/c++/10.2.0/vector:64,                                                                  td::allocator<int>&)'
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/allocator.h:192:7: note: candidate: 'bool std::operator==(const std::allocator<int>&, const std::allocator<int>&)'                                                                                                                  nst std::allocator<int>&'
  192 |       operator==(const allocator&, const allocator&) _GLIBCXX_NOTHROW
      |       ^~~~~~~~
C:/msys64/mingw64/include/c++/10.2.0/bits/allocator.h:192:18: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::allocator<int>&'
  192 |       operator==(const allocator&, const allocator&) _GLIBCXX_NOTHROW
      |                  ^~~~~~~~~~~~~~~~                                                                                                                                  t __gnu_cxx::new_allocator<_Tp>&
In file included from C:/msys64/mingw64/include/c++/10.2.0/x86_64-w64-mingw32/bits/c++allocator.h:33,                                  __gnu_cxx::new_allocator<int>&, cons
                 from C:/msys64/mingw64/include/c++/10.2.0/bits/allocator.h:46,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:64,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/ext/new_allocator.h:171:2: note: candidate: 'template<class _Up> bool __gnu_cxx::operator==(const 
__gnu_cxx::new_allocator<int>&, const __gnu_cxx::new_allocator<_Tp>&
'
  171 |  operator==(const new_allocator&, const new_allocator<_Up>&)
      |  ^~~~~~~~
C:/msys64/mingw64/include/c++/10.2.0/ext/new_allocator.h:171:2: note:   template argument deduction/substitution failed:               const int'
In file included from C:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:71,
                 from C:/msys64/mingw64/include/c++/10.2.0/vector:60,
                 from .\main.cc:1:
C:/msys64/mingw64/include/c++/10.2.0/bits/predefined_ops.h:268:17: note:   mismatched types 'const __gnu_cxx::new_allocator<_Tp>' and 'const int'
  268 |  { return *__it == _M_value; }
      |           ~~~~~~^~~~~~~~~~~

komentarz 11 grudnia 2020 przez tkz Nałogowiec (42,000 p.)

GCC i limit 15000 zanaków... 

clang --version
clang version 11.0.0 (https://github.com/msys2/MINGW-packages c0083b9edc111315c868f9c53dd60aaa78d1669b)
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:\msys64\mingw64\bin

clang .\main.cc
In file included from .\main.cc:1:
In file included from C:\msys64\mingw64\include\c++\10.2.0\vector:60:
In file included from C:\msys64\mingw64\include\c++\10.2.0\bits/stl_algobase.h:71:
C:\msys64\mingw64\include\c++\10.2.0\bits/predefined_ops.h:268:17: error: invalid operands to binary expression
      ('std::vector<int, std::allocator<int>>' and 'const int')
        { return *__it == _M_value; }
                 ~~~~~ ^  ~~~~~~~~
C:\msys64\mingw64\include\c++\10.2.0\bits/stl_algobase.h:1932:8: note: in instantiation of function template specialization
      '__gnu_cxx::__ops::_Iter_equals_val<const int>::operator()<__gnu_cxx::__normal_iterator<std::vector<int, std::allocator<int>> *, 
      std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>>>' requested here      
          if (__pred(__first))
              ^
C:\msys64\mingw64\include\c++\10.2.0\bits/stl_algobase.h:1977:14: note: in instantiation of function template specialization
      'std::__find_if<__gnu_cxx::__normal_iterator<std::vector<int, std::allocator<int>> *, std::vector<std::vector<int,
      std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>>, __gnu_cxx::__ops::_Iter_equals_val<const int>>'   
      requested here
      return __find_if(__first, __last, __pred,
             ^
C:\msys64\mingw64\include\c++\10.2.0\bits/stl_algo.h:3902:19: note: in instantiation of function template specialization
      'std::__find_if<__gnu_cxx::__normal_iterator<std::vector<int, std::allocator<int>> *, std::vector<std::vector<int,
      std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>>, __gnu_cxx::__ops::_Iter_equals_val<const int>>'   
      requested here
      return std::__find_if(__first, __last,
                  ^
.\main.cc:7:64: note: in instantiation of function template specialization 'std::find<__gnu_cxx::__normal_iterator<std::vector<int,    
      std::allocator<int>> *, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int,
      std::allocator<int>>>>>, int>' requested here
    std::vector< std::vector <int> >::const_iterator it = std::find( v.begin(), v.end(), a );
                                                               ^
C:\msys64\mingw64\include\c++\10.2.0\bits/allocator.h:192:7: note: candidate function not viable: no known conversion from
      'std::vector<int, std::allocator<int>>' to 'const std::allocator<int>' for 1st argument
      operator==(const allocator&, const allocator&) _GLIBCXX_NOTHROW
      ^
C:\msys64\mingw64\include\c++\10.2.0\bits/stl_pair.h:466:5: note: candidate template ignored: could not match 'pair' against 'vector'  
    operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
    ^
C:\msys64\mingw64\include\c++\10.2.0\bits/stl_iterator.h:360:5: note: candidate template ignored: could not match 'reverse_iterator'   
      against 'vector'
    operator==(const reverse_iterator<_Iterator>& __x,
    ^
C:\msys64\mingw64\include\c++\10.2.0\bits/stl_iterator.h:398:5: note: candidate template ignored: could not match 'reverse_iterator'   
      against 'vector'
    operator==(const reverse_iterator<_IteratorL>& __x,
    ^
C:\msys64\mingw64\include\c++\10.2.0\bits/stl_iterator.h:1064:5: note: candidate template ignored: could not match '__normal_iterator' 
      against 'vector'
    operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
    ^
C:\msys64\mingw64\include\c++\10.2.0\bits/stl_iterator.h:1072:5: note: candidate template ignored: could not match '__normal_iterator' 
      against 'vector'
    operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
    ^
C:\msys64\mingw64\include\c++\10.2.0\bits/stl_iterator.h:1427:5: note: candidate template ignored: could not match 'move_iterator'     
      against 'vector'
    operator==(const move_iterator<_IteratorL>& __x,
    ^
C:\msys64\mingw64\include\c++\10.2.0\bits/stl_iterator.h:1495:5: note: candidate template ignored: could not match 'move_iterator'     
      against 'vector'
    operator==(const move_iterator<_Iterator>& __x,
    ^
C:\msys64\mingw64\include\c++\10.2.0\ext/new_allocator.h:171:2: note: candidate template ignored: could not match
      'new_allocator<type-parameter-0-0>' against 'const int'
        operator==(const new_allocator&, const new_allocator<_Up>&)
        ^
C:\msys64\mingw64\include\c++\10.2.0\bits/allocator.h:206:5: note: candidate template ignored: could not match 'allocator' against     
      'vector'
    operator==(const allocator<_T1>&, const allocator<_T2>&)
    ^
C:\msys64\mingw64\include\c++\10.2.0\bits/stl_vector.h:1892:5: note: candidate template ignored: could not match
      'vector<type-parameter-0-0, type-parameter-0-1>' against 'const int'
    operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
    ^
1 error generated.

 

GCC zawsze miało przepotworne komunikaty o błędach, szczególnie przy szablonach. Może kiedyś będzie lepiej. 

komentarz 11 grudnia 2020 przez tangarr Mędrzec (154,860 p.)
Dlatego czekamy na koncepty
komentarz 11 grudnia 2020 przez tangarr Mędrzec (154,860 p.)

Zasadniczo to oba kompilatory zgłosiły ten sam błąd

GCC

error: no match for 'operator==' (operand types are 'std::vector<int>' and 'const int')
  268 |  { return *__it == _M_value; } 

Clang

error: invalid operands to binary expression
      ('std::vector<int, std::allocator<int>>' and 'const int')
        { return *__it == _M_value; } 

Reszta to tylko dodatkowe informacje diagnostyczne

W całym tym gąszczu informacji ciężko się odnaleźć, dlatego używamy środowisk programistycznych, które odnajdują i pokazują ważne linie w wyjściu kompilatora.

komentarz 11 grudnia 2020 przez tkz Nałogowiec (42,000 p.)
Oprócz celu liczy się też droga, przynajmniej według mnie. Jeżeli muszę poświęcić 5 minut na szukaniu błędu..
komentarz 11 grudnia 2020 przez Wiciorny Ekspert (270,190 p.)
Miejscie na uwadze, że ja odp. na -> sendo pytania "jaki kompilator' nie jakie IDE stąd :) napisałem tylko to, oczywiście jak tangarr napisał "dlatego używamy IDE" :)
0 głosów
odpowiedź 11 grudnia 2020 przez wizarddos Nałogowiec (25,930 p.)
komplikatorów nie ma. Są tylko kompilatory. Jeżeli jakiegoś potrzebujesz bo w twoim IDE nie działa to może gcc, clang. A jak potrzebujesz całego IDE to już się myślę rozwarstwia. Jak dopiero się uczysz, piszesz małe programy to lepiej codeblocks. Mniej różnorakich udziwnień bo w Visual Studio i tak będziesz korzystał tylko z "kompiluj rozwiązanie" i "Uruchom bez debugowania".  A Visual Studio Code to tylko edytor i trzeba doinstalowywać kompilatory do niego

Podobne pytania

0 głosów
1 odpowiedź 312 wizyt
pytanie zadane 20 grudnia 2019 w C i C++ przez fff Gaduła (3,950 p.)
0 głosów
2 odpowiedzi 406 wizyt

92,576 zapytań

141,426 odpowiedzi

319,652 komentarzy

61,961 pasjonatów

Motyw:

Akcja Pajacyk

Pajacyk od wielu lat dożywia dzieci. Pomóż klikając w zielony brzuszek na stronie. Dziękujemy! ♡

Oto polecana książka warta uwagi.
Pełną listę książek znajdziesz tutaj.

Akademia Sekuraka

Kolejna edycja największej imprezy hakerskiej w Polsce, czyli Mega Sekurak Hacking Party odbędzie się już 20 maja 2024r. Z tej okazji mamy dla Was kod: pasjamshp - jeżeli wpiszecie go w koszyku, to wówczas otrzymacie 40% zniżki na bilet w wersji standard!

Więcej informacji na temat imprezy znajdziecie tutaj. Dziękujemy ekipie Sekuraka za taką fajną zniżkę dla wszystkich Pasjonatów!

Akademia Sekuraka

Niedawno wystartował dodruk tej świetnej, rozchwytywanej książki (około 940 stron). Mamy dla Was kod: pasja (wpiszcie go w koszyku), dzięki któremu otrzymujemy 10% zniżki - dziękujemy zaprzyjaźnionej ekipie Sekuraka za taki bonus dla Pasjonatów! Książka to pierwszy tom z serii o ITsec, który łagodnie wprowadzi w świat bezpieczeństwa IT każdą osobę - warto, polecamy!

...