Форум программистов, компьютерный форум, киберфорум
C++/CLI Windows Forms
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.50/6: Рейтинг темы: голосов - 6, средняя оценка - 4.50
2 / 2 / 0
Регистрация: 02.04.2014
Сообщений: 111

Как инициализировать дек?

13.09.2017, 17:55. Показов 1371. Ответов 17
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
не совсем разберусь как работать с деками на форме. при запуске с такой записью вылетает ошибка
error C3845: lb3_::Form1::dq1: только статические данные-члены можно инициализировать внутри класс ссылки или типа, передаваемого по значению c:\users\artem\desktop\lb3_\lb3_\Form1.h 176 1 lb3_

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#pragma once
#include"deque.h"
#include<string>
namespace lb3_ {
 
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::IO;
    using namespace std;
    
    std::string logtext2;
    public ref class Form1 : public System::Windows::Forms::Form
    { 
    public:
        Form1(void)
        {
            InitializeComponent();
    
        }
 
    protected:
        
        ~Form1()
        {
            if (components)
            {
                delete components;
            }
        }
            
    protected:
    private: System::Windows::Forms::Button^  button1;
    private: System::Windows::Forms::Button^  button2;
    private: System::Windows::Forms::Button^  button3;
 
 
    private: System::Windows::Forms::TextBox^  textBox2;
    private: System::Windows::Forms::TextBox^  textBox3;
    private: System::Windows::Forms::Button^  button5;
    private: System::Windows::Forms::TextBox^  textBox1;
    private: System::Windows::Forms::Button^  button6;
    private: System::Windows::Forms::Button^  button7;
    private:
        /// <summary>
        /// Требуется переменная конструктора.
        /// </summary>
        System::ComponentModel::Container ^components;
 
#pragma region Windows Form Designer generated code
        /// <summary>
        /// Обязательный метод для поддержки конструктора - не изменяйте
        /// содержимое данного метода при помощи редактора кода.
        /// </summary>
        void InitializeComponent(void)
        {
            this->button1 = (gcnew System::Windows::Forms::Button());
            this->button2 = (gcnew System::Windows::Forms::Button());
            this->button3 = (gcnew System::Windows::Forms::Button());
            this->textBox2 = (gcnew System::Windows::Forms::TextBox());
            this->textBox3 = (gcnew System::Windows::Forms::TextBox());
            this->button5 = (gcnew System::Windows::Forms::Button());
            this->textBox1 = (gcnew System::Windows::Forms::TextBox());
            this->button6 = (gcnew System::Windows::Forms::Button());
            this->button7 = (gcnew System::Windows::Forms::Button());
            this->SuspendLayout();
            // 
            // button1
            // 
            this->button1->Location = System::Drawing::Point(7, 67);
            this->button1->Name = L"button1";
            this->button1->Size = System::Drawing::Size(96, 35);
            this->button1->TabIndex = 0;
            this->button1->Text = L"добавить в начало";
            this->button1->UseVisualStyleBackColor = true;
            this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
            // 
            // button2
            // 
            this->button2->Location = System::Drawing::Point(6, 150);
            this->button2->Name = L"button2";
            this->button2->Size = System::Drawing::Size(97, 36);
            this->button2->TabIndex = 1;
            this->button2->Text = L"удалить с начала";
            this->button2->UseVisualStyleBackColor = true;
            this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
            // 
            // button3
            // 
            this->button3->Location = System::Drawing::Point(8, 233);
            this->button3->Name = L"button3";
            this->button3->Size = System::Drawing::Size(95, 23);
            this->button3->TabIndex = 2;
            this->button3->Text = L"размер";
            this->button3->UseVisualStyleBackColor = true;
            this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
            // 
            // textBox2
            // 
            this->textBox2->Location = System::Drawing::Point(114, 12);
            this->textBox2->Multiline = true;
            this->textBox2->Name = L"textBox2";
            this->textBox2->Size = System::Drawing::Size(172, 273);
            this->textBox2->TabIndex = 5;
            // 
            // textBox3
            // 
            this->textBox3->Location = System::Drawing::Point(292, 12);
            this->textBox3->Multiline = true;
            this->textBox3->Name = L"textBox3";
            this->textBox3->Size = System::Drawing::Size(168, 273);
            this->textBox3->TabIndex = 6;
            // 
            // button5
            // 
            this->button5->Location = System::Drawing::Point(8, 38);
            this->button5->Name = L"button5";
            this->button5->Size = System::Drawing::Size(95, 23);
            this->button5->TabIndex = 7;
            this->button5->Text = L"открыть";
            this->button5->UseVisualStyleBackColor = true;
            this->button5->Click += gcnew System::EventHandler(this, &Form1::button5_Click);
            // 
            // textBox1
            // 
            this->textBox1->Location = System::Drawing::Point(8, 12);
            this->textBox1->Name = L"textBox1";
            this->textBox1->Size = System::Drawing::Size(95, 20);
            this->textBox1->TabIndex = 8;
            this->textBox1->Text = L"C:\\\\Users\\\\artem\\\\Desktop\\\\Lb3_\\\\Lb3_\\\\file.txt";
            // 
            // button6
            // 
            this->button6->Location = System::Drawing::Point(7, 110);
            this->button6->Name = L"button6";
            this->button6->Size = System::Drawing::Size(96, 36);
            this->button6->TabIndex = 9;
            this->button6->Text = L"добавить в конец";
            this->button6->UseVisualStyleBackColor = true;
            this->button6->Click += gcnew System::EventHandler(this, &Form1::button6_Click);
            // 
            // button7
            // 
            this->button7->Location = System::Drawing::Point(8, 192);
            this->button7->Name = L"button7";
            this->button7->Size = System::Drawing::Size(95, 35);
            this->button7->TabIndex = 10;
            this->button7->Text = L"удалить с конца";
            this->button7->UseVisualStyleBackColor = true;
            this->button7->Click += gcnew System::EventHandler(this, &Form1::button7_Click);
            // 
            // Form1
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(469, 308);
            this->Controls->Add(this->button7);
            this->Controls->Add(this->button6);
            this->Controls->Add(this->textBox1);
            this->Controls->Add(this->button5);
            this->Controls->Add(this->textBox3);
            this->Controls->Add(this->textBox2);
            this->Controls->Add(this->button3);
            this->Controls->Add(this->button2);
            this->Controls->Add(this->button1);
            this->Name = L"Form1";
            this->Text = L"Form1";
            this->ResumeLayout(false);
            this->PerformLayout();
 
        }
#pragma endregion
    private: DEQUE *dq1 = new DEQUE();
    private: String^ a;
    private: array<String^>^ b; 
    private: int *integ;
    public: void addLog(String ^str)
             {
                 textBox3->AppendText(str + Environment::NewLine);
             }
 
    public: void updateStr()
            {
                String^ logtext12 = gcnew String(logtext2.c_str());
                textBox2->Text = logtext12;
            }
        
    private: System::Void button5_Click(System::Object^  sender, System::EventArgs^  e) {
        StreamReader^ file = gcnew StreamReader(textBox1->Text);
        a = file->ReadToEnd();
        b = a->Split(';');
        integ = new int[b->Length];
        for (int i = 0; i < b->Length; i++)
        {
            integ[i] = Int32::Parse(b[i]);
        }
        addLog("Файл загружен!");
    }
                        private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
        logtext2 += DequeAddAtFront(dq1, 0, integ ,sizeof(integ))+ ' ';
        updateStr();
        addLog("Элемент добавлен в начало!");
    }
 
    private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
        logtext2 = "";
        DEQUE *dq2 = dq1;
        if (DequeCount(dq1) > 0)
        {
            DequeRemoveFromFront(integ, dq1);
            addLog("Элемент удалён!");
        }
        else addLog("пустая очередь!");
        for (int i = 0; i < DequeCount(dq1); i++)
        {
            logtext2 += DequeRemoveFromFront(integ, dq2) + ' ';
        }
    }
 
    private: System::Void button3_Click(System::Object^  sender, System::EventArgs^  e) {
        addLog("количество элементов в очереди:" + DequeCount(dq1));
    }
 
    private: System::Void button7_Click(System::Object^  sender, System::EventArgs^  e) {   logtext2 = "";
        DEQUE *dq3 = dq1;
        if (DequeCount(dq1) > 0)
        {
            DequeRemoveFromBack(integ, dq1);
            addLog("Элемент удалён!");
        }
        else addLog("пустая очередь!");
        for (int i = 0; i < DequeCount(dq1); i++)
        {
            logtext2 += DequeRemoveFromBack(integ, dq3) + ' ';
        }
             }
 
private: System::Void button6_Click(System::Object^  sender, System::EventArgs^  e) {
             logtext2 += DequeAddAtBack(dq1, 0, integ ,sizeof(integ))+ ' ';
        updateStr();
        addLog("Элемент добавлен в конец!");
         }
 
};
}
0
Programming
Эксперт
39485 / 9562 / 3019
Регистрация: 12.04.2006
Сообщений: 41,671
Блог
13.09.2017, 17:55
Ответы с готовыми решениями:

Как реализовать Дек на java
Как мне реализовать Дек на java..точнее как сделать вывод? у меня не получается class Deque { int size; int head;...

Реализовать дек как массив, создать процедуры добавления и удаления
надо реализовать дек через массив. такой вопрос. дек - это как бэ очередь с возможностями удаления и добавления как в стеке.а вот что...

Создание ДЕК (как стэк только о двух концах) без <deque>
здравствуйте! написал класс Deque, создал методы push_back(), push_front(), pop_back(), pop_front()... Все работает нормально, кроме...

17
Администратор
Эксперт .NET
 Аватар для OwenGlendower
18298 / 14222 / 5368
Регистрация: 17.03.2014
Сообщений: 28,900
Записей в блоге: 1
13.09.2017, 17:59
SakinT, попробуй перенести инициализацию в конструктор класса.
0
2 / 2 / 0
Регистрация: 02.04.2014
Сообщений: 111
17.09.2017, 11:52  [ТС]
OwenGlendower, можете в коде примерно показать в каком месте... что-то не совсем пойму... впервые с C++ winform работаю
0
Администратор
Эксперт .NET
 Аватар для OwenGlendower
18298 / 14222 / 5368
Регистрация: 17.03.2014
Сообщений: 28,900
Записей в блоге: 1
17.09.2017, 13:25
SakinT,
C++
1
2
3
4
5
6
7
8
    public:
        Form1(void) // Конструктор класса Form1
        {
            InitializeComponent();
            dq1 = new DEQUE(); // Инициализация
        }
 
    private: DEQUE *dq1; // Объявление
0
2 / 2 / 0
Регистрация: 02.04.2014
Сообщений: 111
17.09.2017, 14:23  [ТС]
OwenGlendower,подправил,но теперь вылетает вот это Ошибка 7 error LNK2028: ссылка на неразрешенную лексему (0A000023) "int __clrcall DequeAddAtFront(struct DEQUE *,int,void *,unsigned int)" (?DequeAddAtFront@@$$FYMHPAUDEQUE@@HPAXI @Z) в функции "private: void __clrcall lab3::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" (?button1_Click@Form1@lab3@@$$FA$AAMXP$A AVObject@System@@P$AAVEventArgs@4@@Z) C:\Users\artem\Desktop\lab3\lab3\lab3.ob j lab3
0
Администратор
Эксперт .NET
 Аватар для OwenGlendower
18298 / 14222 / 5368
Регистрация: 17.03.2014
Сообщений: 28,900
Записей в блоге: 1
17.09.2017, 14:42
SakinT, похоже отсутствует метод DequeAddAtFront. Объяви его или закоментируй строку с его вызовом.
0
2 / 2 / 0
Регистрация: 02.04.2014
Сообщений: 111
17.09.2017, 15:04  [ТС]
OwenGlendower,
Цитата Сообщение от OwenGlendower Посмотреть сообщение
похоже отсутствует метод DequeAddAtFron
эмм...в подключенном заголовочном он прописан как и остальные методы.
:
deque.h
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*  deque.h - header for deque library
 *
 *  DEQUE - Deque Library
 *
 *          Depends on DLLIST
 *
 *  Copyright (C) 2000  Richard Heathfield
 *                      Eton Computer Systems Ltd
 *                      Macmillan Computer Publishing
 *
 *  This program is free software; you can redistribute it
 *  and/or modify it under the terms of the GNU General
 *  Public License as published by the Free Software
 *  Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will
 *  be useful, but WITHOUT ANY WARRANTY; without even the
 *  implied warranty of MERCHANTABILITY or FITNESS FOR A
 *  PARTICULAR PURPOSE.  See the GNU General Public License
 *  for more details.
 *
 *  You should have received a copy of the GNU General
 *  Public License along with this program; if not, write
 *  to the Free Software Foundation, Inc., 675 Mass Ave,
 *  Cambridge, MA 02139, USA.
 *
 *  Richard Heathfield may be contacted by email at:
 *     binary@eton.powernet.co.uk
 *
 */
 
#ifndef DEQUE_H__
#define DEQUE_H__
 
#include "dllist.h"
 
#define DEQUE_SUCCESS       0
#define DEQUE_ADD_FAILURE   1
#define DEQUE_DEL_FAILURE   2
#define DEQUE_EMPTY         3
 
typedef struct DEQUE
{
#ifndef NDEBUG
  int CheckInit1;
#endif
 
  DLLIST *HeadPtr;
  DLLIST *TailPtr;
  size_t NumItems;
 
#ifndef NDEBUG
  int CheckInit2;
#endif
} DEQUE;
 
int DequeAddAtFront(DEQUE *Deque,
                    int Tag,
                    void *Object,
                    size_t Size);
int DequeAddAtBack(DEQUE *Deque,
                   int Tag,
                   void *Object,
                   size_t Size);
int DequeRemoveFromFront(void *Object, DEQUE *Deque);
int DequeRemoveFromBack(void *Object, DEQUE *Deque);
 
void *DequeGetDataFromFront(DEQUE *Deque,
                            int *Tag,
                            size_t *Size);
void *DequeGetDataFromBack(DEQUE *Deque,
                           int *Tag,
                           size_t *Size);
size_t DequeCount(DEQUE *Deque);
 
#endif
0
Администратор
Эксперт .NET
 Аватар для OwenGlendower
18298 / 14222 / 5368
Регистрация: 17.03.2014
Сообщений: 28,900
Записей в блоге: 1
17.09.2017, 15:11
SakinT, это только объявление (declaration) метода. Нужна еще его определение (definition) или по другому - реализация.
0
2 / 2 / 0
Регистрация: 02.04.2014
Сообщений: 111
17.09.2017, 15:37  [ТС]
OwenGlendower, не оно??

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
int DequeAddAtFront(DEQUE *Deque,
                    int Tag,
                    void *Object,
                    size_t Size)
{
  int Result = DEQUE_ADD_FAILURE;
  int ListResult;
  assert(Deque != NULL);
  assert(0 == Deque->CheckInit1 && 0 == Deque->CheckInit2);
 
  ListResult = DLAddBefore(&Deque->HeadPtr,
                           Tag,
                           Object,
                           Size);
 
  if(DL_SUCCESS == ListResult)
  {
    if(0 == Deque->NumItems)
    {
      Deque->TailPtr = Deque->HeadPtr;
    }
    else
    {
      Deque->HeadPtr = Deque->HeadPtr->Prev;
    }
 
    Result = DEQUE_SUCCESS;
    ++Deque->NumItems;
  }
 
  return Result;
}
 
int DequeAddAtBack(DEQUE *Deque,
                   int    Tag,
                   void * Object,
                   size_t Size)
{
  int Result = DEQUE_ADD_FAILURE;
  int ListResult;
  assert(Deque != NULL);
  assert(0 == Deque->CheckInit1 && 0 == Deque->CheckInit2);
 
  ListResult = DLAddAfter(&Deque->TailPtr,
                          Tag,
                          Object,
                          Size);
 
  if(DL_SUCCESS == ListResult)
  {
    if(0 == Deque->NumItems)
    {
      Deque->HeadPtr = Deque->TailPtr;
    }
    else
    {
      Deque->TailPtr = Deque->TailPtr->Next;
    }
 
    Result = DEQUE_SUCCESS;
    ++Deque->NumItems;
  }
 
  return Result;
}
 
int DequeRemoveFromFront(void *Object, DEQUE *Deque)
{
  size_t Size;
  void *p;
  DLLIST *Temp;
  int Result = DEQUE_SUCCESS;
 
  assert(Deque != NULL);
  assert(0 == Deque->CheckInit1 && 0 == Deque->CheckInit2);
 
  if(Deque->NumItems > 0)
  {
    p = DLGetData(Deque->HeadPtr, NULL, &Size);
    if(p != NULL)
    {
      if(Object != NULL)
      {
        memcpy(Object, p, Size);
      }
      Temp = Deque->HeadPtr->Next;
      DLDelete(Deque->HeadPtr);
      Deque->HeadPtr = Temp;
 
      --Deque->NumItems;
      if(0 == Deque->NumItems)
      {
        Deque->TailPtr = NULL;
      }
    }
    else
    {
      Result = DEQUE_DEL_FAILURE;
    }
  }
  else
  {
    Result = DEQUE_EMPTY;
  }
 
  return Result;
}
 
int DequeRemoveFromBack(void *Object, DEQUE *Deque)
{
  size_t Size;
  void *p;
  DLLIST *Temp;
  int Result = DEQUE_SUCCESS;
 
  assert(Deque != NULL);
  assert(0 == Deque->CheckInit1 && 0 == Deque->CheckInit2);
 
  if(Deque->NumItems > 0)
  {
    p = DLGetData(Deque->TailPtr, NULL, &Size);
    if(p != NULL)
    {
      if(Object != NULL)
      {
        memcpy(Object, p, Size);
      }
      Temp = Deque->TailPtr->Prev;
      DLDelete(Deque->TailPtr);
      Deque->TailPtr = Temp;
 
      --Deque->NumItems;
      if(0 == Deque->NumItems)
      {
        Deque->HeadPtr = NULL;
      }
    }
    else
    {
      Result = DEQUE_DEL_FAILURE;
    }
  }
  else
  {
    Result = DEQUE_EMPTY;
  }
 
  return Result;
}
 
void *DequeGetDataFromFront(DEQUE *Deque,
                            int *Tag,
                            size_t *Size)
{
  assert(Deque != NULL);
  assert(0 == Deque->CheckInit1 && 0 == Deque->CheckInit2);
 
  return DLGetData(Deque->HeadPtr, Tag, Size);
}
 
void *DequeGetDataFromBack(DEQUE *Deque,
                           int *Tag,
                           size_t *Size)
{
  assert(Deque != NULL);
  assert(0 == Deque->CheckInit1 && 0 == Deque->CheckInit2);
 
  return DLGetData(Deque->TailPtr, Tag, Size);
}
 
size_t DequeCount(DEQUE *Deque)
{
  assert(Deque != NULL);
  assert(0 == Deque->CheckInit1 && 0 == Deque->CheckInit2);
  return Deque->NumItems;
}
 
void DequeDestroy(DEQUE *Deque)
{
  assert(Deque != NULL);
  assert(0 == Deque->CheckInit1 && 0 == Deque->CheckInit2);
  DLDestroy(&Deque->HeadPtr);
  Deque->TailPtr = NULL;
}
0
Администратор
Эксперт .NET
 Аватар для OwenGlendower
18298 / 14222 / 5368
Регистрация: 17.03.2014
Сообщений: 28,900
Записей в блоге: 1
17.09.2017, 15:39
SakinT, оно. Лучше всего в отдельный cpp файл.
0
2 / 2 / 0
Регистрация: 02.04.2014
Сообщений: 111
17.09.2017, 16:04  [ТС]
OwenGlendower, блиин,что же я не так делаю то . ну добавил в отд cpp файл все это дело теперь вылезло Ошибка 8 error C2084: функция "void *DequeGetDataFromBack(DEQUE *,int *,size_t *)" уже имеет текст реализации C:\Users\artem\Desktop\lab3\lab3\lab3.cp p 185 1 lab3
ну и с остальными функциями оттуда то же самое
0
Администратор
Эксперт .NET
 Аватар для OwenGlendower
18298 / 14222 / 5368
Регистрация: 17.03.2014
Сообщений: 28,900
Записей в блоге: 1
17.09.2017, 16:15
SakinT, ошиба говорит сама за себя - в проекте уже есть определение этих функций. Удали cpp файл который ты только что создал и добавь в файл Form1.h директиву #include с именем h файла где объявлена функция DequeAddAtFront.
0
2 / 2 / 0
Регистрация: 02.04.2014
Сообщений: 111
17.09.2017, 16:38  [ТС]
OwenGlendower, ну хорошо. добавил эти строки в deque.h сейчас. начал ругаться на содержимое файла dllist.h подключенного к deque.h
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*  dllist.h
 *
 *  DLLIST - Double-Linked List Library
 *
 *  Copyright (C) 2000  Richard Heathfield
 *                      Eton Computer Systems Ltd
 *                      Macmillan Computer Publishing
 *
 *  This program is free software; you can redistribute it
 *  and/or modify it under the terms of the GNU General
 *  Public License as published by the Free Software
 *  Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will
 *  be useful, but WITHOUT ANY WARRANTY; without even the
 *  implied warranty of MERCHANTABILITY or FITNESS FOR A
 *  PARTICULAR PURPOSE.  See the GNU General Public License
 *  for more details.
 *
 *  You should have received a copy of the GNU General
 *  Public License along with this program; if not, write
 *  to the Free Software Foundation, Inc., 675 Mass Ave,
 *  Cambridge, MA 02139, USA.
 *
 *  Richard Heathfield may be contacted by email at:
 *     binary@eton.powernet.co.uk
 *
 */
 
#ifndef DLLIST_H__
#define DLLIST_H__
 
#define DL_SUCCESS      0
#define DL_NO_MEM       1
#define DL_ZERO_SIZE    2
#define DL_NULL_POINTER 3
 
typedef struct DLLIST
{
  int Tag;
  struct DLLIST *Prev;
  struct DLLIST *Next;
  void *Object;
  size_t Size;
} DLLIST;
 
DLLIST *DLCreate(int Tag, void *Object, size_t Size);
 
/* Insert existing item into list, just
 * before the item provided.
 */
int DLInsertBefore(DLLIST *ExistingItem, DLLIST *NewItem);
 
/* Insert existing item into list, just
 * after the item provided.
 */
int DLInsertAfter(DLLIST *ExistingItem, DLLIST *NewItem);
 
/* Add item at start of list */
int DLPrepend(DLLIST **Item,
              int Tag,
              void *Object,
              size_t Size);
 
/* Add item at end of list */
int DLAppend(DLLIST **Item,
             int Tag,
             void *Object,
             size_t Size);
 
/* Add new item immediately after current item */
int DLAddAfter(DLLIST **Item,
               int Tag,
               void *Object,
               size_t Size);
 
/* Add new item immediately before current item */
int DLAddBefore(DLLIST **Item,
                int Tag,
                void *Object,
                size_t Size);
 
/* Update one item */
int DLUpdate(DLLIST *Item,
             int NewTag,
             void *NewObject,
             size_t NewSize);
 
/* Get a pointer to the data */
void *DLGetData(DLLIST *Item,
                int *Tag,
                size_t *Size);
 
/* Extract one item from the
 * list, without destroying it.
 */
DLLIST *DLExtract(DLLIST *Item);
 
/* Delete one item in the list */
void DLDelete(DLLIST *Item);
 
/* Exchange two items. Both must be non-NULL. */
int DLExchange(DLLIST *ItemA, DLLIST *ItemB);
 
/* Destroy the entire list */
void DLDestroy(DLLIST **List);
 
/* List navigation functions */
DLLIST *DLGetPrev(DLLIST *List);
DLLIST *DLGetNext(DLLIST *List);
DLLIST *DLGetFirst(DLLIST *List);
DLLIST *DLGetLast(DLLIST *List);
 
DLLIST *DLJoin(DLLIST *Left, DLLIST *Right);
int DLCount(DLLIST *List);
 
/* Walk the list */
int DLWalk(DLLIST *List,
           int(*Func)(int, void *, void *),
           void *Args);
 
#endif
Ошибка 9 error LNK2019: ссылка на неразрешенный внешний символ "int __clrcall DLAddAfter(struct DLLIST * *,int,void *,unsigned int)" (?DLAddAfter@@$$FYMHPAPAUDLLIST@@HPAXI@Z ) в функции "int __clrcall DequeAddAtBack(struct DEQUE *,int,void *,unsigned int)" (?DequeAddAtBack@@$$FYMHPAUDEQUE@@HPAXI@ Z) C:\Users\artem\Desktop\lab3\lab3\lab3.ob j lab3
0
Администратор
Эксперт .NET
 Аватар для OwenGlendower
18298 / 14222 / 5368
Регистрация: 17.03.2014
Сообщений: 28,900
Записей в блоге: 1
18.09.2017, 15:17
SakinT, реализация метода DLAddAfter есть в проекте?
0
2 / 2 / 0
Регистрация: 02.04.2014
Сообщений: 111
20.09.2017, 17:36  [ТС]
OwenGlendower,смотрите код из 9 поста.там вроде как есть
0
Администратор
Эксперт .NET
 Аватар для OwenGlendower
18298 / 14222 / 5368
Регистрация: 17.03.2014
Сообщений: 28,900
Записей в блоге: 1
20.09.2017, 17:37
SakinT, в посте #9 есть только вызов этого метода
0
2 / 2 / 0
Регистрация: 02.04.2014
Сообщений: 111
21.09.2017, 11:09  [ТС]
OwenGlendower,все заголовки что были в проекте : deue.h,dllist.h в них кажется текста самих методов нет . только объявление...
Вложения
Тип файла: 7z заголовки из проекта.7z (2.1 Кб, 5 просмотров)
0
Администратор
Эксперт .NET
 Аватар для OwenGlendower
18298 / 14222 / 5368
Регистрация: 17.03.2014
Сообщений: 28,900
Записей в блоге: 1
21.09.2017, 12:50
SakinT, в приведенных файлах объявление метода DLAddAfter есть, а определение отсуствует. Поэтому компоновщик её и не находит.
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
inter-admin
Эксперт
29715 / 6470 / 2152
Регистрация: 06.03.2009
Сообщений: 28,500
Блог
21.09.2017, 12:50
Помогаю со студенческими работами здесь

Как инициализировать новую форму, с такими же свойствами как и родительская?
Здравствуйте, подскажите пожалуйста, как создать новую форму, с такими же кнопками и с таким же кодом как и в форме создающей эту форму? ...

Как объявить указатель на массив через typedef и как инициализировать такой тип
Как заставить заработать этот фрагмент кода? INT_L -- указатель на массив из 100 элементов типа char; Не получается в переменную C...

Как добавить генератор случайных чисел в дек,чтобы не забивать список вручную?
#include &quot;stdafx.h&quot; #include &lt;iostream&gt; #include &lt;conio.h&gt; #include &lt;cstdlib&gt; #include &lt;ctime&gt; using namespace std; struct...

Как инициализировать объект
Здравствуйте Не сталкивался раньше с ооп. Я создал класс: Файл Cars (класс): Public model As String Public number As String...

Как инициализировать структуру
имеется структура point {int x; int y;} вопрос таков как мне не создавая переменной передать структуру в функцию т.е. struct point...


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

Или воспользуйтесь поиском по форуму:
18
Ответ Создать тему
Новые блоги и статьи
Кому нужен AOT?
DevAlt 26.03.2026
Решил сделать простой ланчер Написал заготовку: dotnet new console --aot -o UrlHandler var items = args. Split(":"); var tag = items; var id = items; var executable = args;. . .
Отправка уведомления на почту при изменении наименования справочника
Maks 24.03.2026
Программная отправка письма электронной почты на примере изменения наименования типового справочника "Склады" в конфигурации БП3. Перед реализацией необходимо выполнить настройку системной учетной. . .
модель ЗдравоСохранения 5. Меньше увольнений- больше дохода!
anaschu 24.03.2026
Теперь система здравосохранения уменьшает количество увольнений. 9TO2GP2bpX4 a42b81fb172ffc12ca589c7898261ccb/ https:/ / rutube. ru/ video/ a42b81fb172ffc12ca589c7898261ccb/ Слева синяя линия -. . .
Midnight Chicago Blues
kumehtar 24.03.2026
Такой Midnight Chicago Blues, знаешь?. . Когда вечерние улицы становятся ночными, а ты не можешь уснуть. Ты идёшь в любимый старый бар, и бармен наливает тебе виски. Ты смотришь на пролетающие. . .
SDL3 для Desktop (MinGW): Вывод текста со шрифтом TTF с помощью библиотеки SDL3_ttf на Си и C++
8Observer8 24.03.2026
Содержание блога Финальные проекты на Си и на C++: finish-text-sdl3-c. zip finish-text-sdl3-cpp. zip
Жизнь в неопределённости
kumehtar 23.03.2026
Жизнь — это постоянное существование в неопределённости. Например, даже если у тебя есть список дел, невозможно дойти до точки, где всё окончательно завершено и больше ничего не осталось. В принципе,. . .
Модель здравоСохранения: работники работают быстрее после её введения.
anaschu 23.03.2026
geJalZw1fLo Корпорация до введения программа здравоохранения имела много невыполненных работниками заданий, после введения программы количество заданий выросло. Но на выплатах по больничным это. . .
Контроль уникальности заводского номера
Maks 23.03.2026
Алгоритм контроля уникальности заводского (или серийного) номера на примере нетипового документа выдачи шин для спецтехники с табличной частью, разработанного в конфигурации КА2. Номеклатура. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru