Форум программистов, компьютерный форум, киберфорум
Visual C++
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.67/6: Рейтинг темы: голосов - 6, средняя оценка - 4.67
2 / 2 / 0
Регистрация: 05.10.2010
Сообщений: 37
1

Ошибки при использовании STL

03.10.2011, 22:58. Показов 1188. Ответов 2
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Здравствуйте. Нужна очень помощь. Текст программы прикрепил, вот сам лог компиляции:

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
\ooplab8\main.cpp||In function 'int main()':|
\ooplab8\main.cpp|29|warning: deprecated conversion from string constant to 'char*'|
\ooplab8\main.cpp|30|warning: deprecated conversion from string constant to 'char*'|
\ooplab8\main.cpp|31|warning: deprecated conversion from string constant to 'char*'|
\ooplab8\main.cpp|32|warning: deprecated conversion from string constant to 'char*'|
\ooplab8\main.cpp|34|warning: deprecated conversion from string constant to 'char*'|
\ooplab8\main.cpp|35|warning: deprecated conversion from string constant to 'char*'|
\ooplab8\main.cpp|36|warning: deprecated conversion from string constant to 'char*'|
\ooplab8\main.cpp|37|warning: deprecated conversion from string constant to 'char*'|
\ooplab8\main.cpp|49|error: no match for 'operator<' in 'i < bedroomList.std::list<_Tp, _Alloc>::end [with _Tp = CRoomBedroom*, _Alloc = std::allocator<CRoomBedroom*>]()'|
\ooplab8\main.cpp|59|error: no match for 'operator<' in 'i < bedroomList.std::list<_Tp, _Alloc>::end [with _Tp = CRoomBedroom*, _Alloc = std::allocator<CRoomBedroom*>]()'|
\ooplab8\main.cpp|62|error: no matching function for call to 'std::multiset<char*, char*, std::allocator<char*> >::insert(std::pair<char*, char*>)'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\bits\stl_multiset.h|399|note: candidates are: typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator std::multiset<_Key, _Compare, _Alloc>::insert(const _Key&) [with _Key = char*, _Compare = char*, _Alloc = std::allocator<char*>]|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\bits\stl_multiset.h|423|note:                 typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator std::multiset<_Key, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator, const _Key&) [with _Key = char*, _Compare = char*, _Alloc = std::allocator<char*>]|
\ooplab8\main.cpp|66|error: no matching function for call to 'std::multiset<char*, char*, std::allocator<char*> >::insert(std::pair<char*, char*>)'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\bits\stl_multiset.h|399|note: candidates are: typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator std::multiset<_Key, _Compare, _Alloc>::insert(const _Key&) [with _Key = char*, _Compare = char*, _Alloc = std::allocator<char*>]|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\include\c++\bits\stl_multiset.h|423|note:                 typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator std::multiset<_Key, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator, const _Key&) [with _Key = char*, _Compare = char*, _Alloc = std::allocator<char*>]|
\ooplab8\main.cpp|71|error: no matching function for call to 'count(std::_List_iterator<CRoomBedroom*>, std::_List_iterator<CRoomBedroom*>)'|
||=== Build finished: 5 errors, 8 warnings ===|
Больше всего выбивают из колеи ошибки
C++
1
\ooplab8\main.cpp|49|error: no match for 'operator<' in 'i < bedroomList.std::list<_Tp, _Alloc>::end [with _Tp = CRoomBedroom*, _Alloc = std::allocator<CRoomBedroom*>]()'|
и
C++
1
\ooplab8\main.cpp|62|error: no matching function for call to 'std::multiset<char*, char*, std::allocator<char*> >::insert(std::pair<char*, char*>)'|
Не представляю, что с ними делать. Скачал себе весь Гугл - нету. Выручите.
Вложения
Тип файла: rar ooplab8.rar (5.5 Кб, 14 просмотров)
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
03.10.2011, 22:58
Ответы с готовыми решениями:

Ошибки при использовании glaux
вот такие ошибки 1&gt;C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\glaux.lib : warning...

Ошибка при использовании STL
Начал знакомиться с STL, и возникли проблемы. Вот суть: Имеется дочерний класс, одно поле которого...

Ошибки при созадании dataGridView с группировкой в столбцах при использовании CellFormatting
Всем привет!!!! Помогите пожалуйста разобраться. Использую наследование от dataGridView и...

Ошибки при использовании QMouseEvent
Здравствуйте. Я пытаюсь написать простое приложение с использованием OpenGL на Qt. Программа по...

2
Эксперт С++
3071 / 1409 / 425
Регистрация: 19.01.2009
Сообщений: 3,880
04.10.2011, 01:20 2
C++
1
for (TConstIterator i = bedroomList.begin(); i < bedroomList.end(); i++)
надо:
C++
1
for (TConstIterator i = bedroomList.begin(); i != bedroomList.end(); ++i)
Добавлено через 9 минут
Цитата Сообщение от RAZOR1703 Посмотреть сообщение
Код
2\ooplab8\main.cpp|62|error: no matching function for call to 'std::multiset<char*, char*, std::allocator<char*> >::insert(std::pair<char*, char*>)'|
структура для пары объявлена в заголовке <utility>, он у Вас не инклудится.
Но проще использовать шаблонную функцию std::make_pair() из этого же заголовка.

Josuttes - C++ Standard Library: Chapter 4 make_pair
The make_pair() template function enables you to create a value pair without writing the types explicitly[3]:

C++
1
2
3
4
5
6
7
   namespace std {
        //create value pair only by providing the values
        template <class T1, class T2>
        pair<Tl,T2> make_pair (const T1& x, const T2& y) {
            return pair<T1,T2>(x, y);
        }
    }
For example, by using make_pair() you can write

C++
1
   std::make_pair(42, '@')
instead of

C++
1
   std::pair<int,char>(42,'@')
In particular, the make_pair() function makes it convenient to pass two values of a pair directly to a function that requires a pair as its argument. Consider the following example:

C++
1
2
3
4
5
6
7
8
   void f(std::pair<int,const char*>);
    void g(std::pair<const int,std::string>);
    ...
    void foo {
        f(std::make_pair(42,"hello"));     //pass two values as pair
        g(std::make_pair(42,"hello"));     //pass two values as pair
                                           // with type conversions
    }
1
2 / 2 / 0
Регистрация: 05.10.2010
Сообщений: 37
04.10.2011, 18:12  [ТС] 3
schdub,
Оу, спасибо большое. Заработала.
0
04.10.2011, 18:12
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
04.10.2011, 18:12
Помогаю со студенческими работами здесь

Ошибки при использовании header'а
Собственно сама проблема: Имеется два файла, один со скриптом а второй в качестве шаблона. Во...

Ошибки при использовании Сomponentone
Когда я запускаю сайт с любым компонентом componentone, то получаю ошибки: Ошибка 1 Тип...

Ошибки при использовании stringstream
Текст программы: #include &lt;stdio.h&gt; #include &lt;iostream&gt; #include &lt;string.h&gt; using...

Ошибки при использовании FloatToStr
Delphi7. Не могу понять как правильнее написать, он складывает edit,ы ну и считает по формуле,...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
3
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru