Форум программистов, компьютерный форум, киберфорум
С++ для начинающих
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.67/6: Рейтинг темы: голосов - 6, средняя оценка - 4.67
2 / 2 / 2
Регистрация: 05.07.2012
Сообщений: 99

программа выдает ошибку при компиляции

19.10.2012, 15:32. Показов 1306. Ответов 10
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
подскажите, пожалуста, в чем ошибка..При компиляции выскакивает ошибка

[Linker error] undefined reference to 'Obrabotchik::SetListContinents()'

вот код

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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<time.h>
#include<dos.h>
#include<string.h>
#include <iostream>
 
int n=4,m=5;
 
class Country
{
private:
    char Name_Country [30];
    float Naselenije;
    float Ploshad;
    char Forma_Pravl[30];
    
public:
    Country();
    Country(char Name_Country[], float Naselenije, char Forma_Pravl[], float Ploshad);
    ~Country();
    
    char GetName_Country();
    float GetNaselenije();
    float GetPloshad();
    char GetForma_Pravl();
        
    void SetName_Country(char newVal[]);
    void SetNaselenije(float newVal);
    void SetPloshad(float newVal);
    void SetForma_Pravl(char newVal[]);
    
    void Print();
 
};
 
Country::Country()
{
//  printf("Country Constructor without params used\n");
 
    strcpy(Name_Country,"");
    Naselenije = 0;
    Ploshad = 0;
    strcpy(Forma_Pravl,"");
}
 
Country::Country(char Name_Country[], float Naselenije, char Forma_Pravl[], float Ploshad)
{
 //   printf("Country Constructor with params used\n");
 
    strcpy(this->Name_Country,Name_Country);
    this->Naselenije=Naselenije;
    this->Ploshad=Ploshad;
    strcpy(this->Forma_Pravl,Forma_Pravl);
    
    printf("%s \n %f\n %f\n %s\n",this->Name_Country,this->Naselenije,this->Ploshad,this->Forma_Pravl);
}
 
Country::~Country()
{
//  printf("Country Destructor used\n");
    if(Name_Country != NULL)
                       { delete []Name_Country; }
 if(Forma_Pravl != NULL)
  delete []Forma_Pravl;
}
 
void Country::Print()
{
    printf("Nazvanije: %s\n",Name_Country);
    printf("Naselenije: %.2f  \n", Naselenije);
    printf("Ploshad: %.2f \n", Ploshad);
    printf("Forma_Pravl: %s\n",Forma_Pravl);
    
    printf("\n");
}
 
char Country::GetName_Country()
{   return Name_Country[0] ;       }
 
float Country::GetNaselenije()
{   return Naselenije;     }
 
float Country::GetPloshad()
{   return Ploshad;        }
 
char Country::GetForma_Pravl()
{   return Forma_Pravl[0];   }
 
void Country::SetName_Country(char newVal[])
{       strcpy(this->Name_Country,newVal);         }
 
void Country::SetNaselenije(float newVal)
{   this->Naselenije = newVal;          }
 
void Country::SetPloshad(float newVal)
{   this->Ploshad = newVal;          }
 
void Country::SetForma_Pravl(char newVal[])
{   strcpy(this->Forma_Pravl,newVal);     }
 
//_______________________________________________________________________
 
class Continent
{
 
private:
    char Name_Continent [30];
    Country ListCountries [4];
 
public:
    Country *m_Country;
 
    Continent();
    ~Continent();
    
    char GetName_Continent ();
    void SetName_Continent (char newVal[]);
 
    Country GetListCountries (int i);
    void SetListCountries (char Name_Country[],float Naselenije, char Forma_Pravl[], float Ploshad,int i);
 
    void Create_Country(char Forma_Pravl[], float Ploshad, float Naselenije, char Name_Country[]);
    void Delete_Country(int k);//(char Name_Country[]);
 
};
 
 
Continent::Continent()
{
 //    printf("\n \n Continent Constructor without params used\n\n");
 
    strcpy(Name_Continent,"");
 
}
 
Continent::~Continent()
{
//printf("\nContinent Destructor used\n\n");
    if(Name_Continent != NULL)
    { delete []Name_Continent;        }
}
 
 
char Continent::GetName_Continent ()
{    return Name_Continent [0];   }
 
void Continent::SetName_Continent (char newVal[])
{    strcpy(this->Name_Continent,newVal); }
 
 
Country Continent::GetListCountries (int i)
{          
            return ListCountries[i]; 
}
 
 
void Continent::SetListCountries (char Name_Country[],float Naselenije, char Forma_Pravl[], float Ploshad,int i)
{   
    ListCountries[i].SetName_Country(Name_Country);
    ListCountries[i].SetNaselenije(Naselenije);
    ListCountries[i].SetPloshad(Ploshad);
    ListCountries[i].SetForma_Pravl(Forma_Pravl); 
    
    ListCountries[i].Print();
              
}
 
 
void Continent::Create_Country( char Forma_Pravl[], float Ploshad, float Naselenije, char Name_Country[])
{
ListCountries[n].SetForma_Pravl(Forma_Pravl);
ListCountries[n].SetPloshad(Ploshad);
ListCountries[n].SetNaselenije(Naselenije);
ListCountries[n].SetName_Country(Name_Country);
 ListCountries[n].Print();
n+=1;
}
 
 
 
void Continent::Delete_Country(int k)//(char Name_Country[])
{
//int k;
 
//for(k=0;k<n;k++)
{
//if(strcmp((char*)ListCountries[k].GetName_Country(), "one")==0)
     { 
    ListCountries[k].SetName_Country("");
     ListCountries[k].SetNaselenije(0);
     ListCountries[k].SetPloshad(0);
     ListCountries[k].SetForma_Pravl("");
     // + смещение и //n-=1;
     }
}
 
 
 
 
printf("_____\n");
for(int i=0;i<n;i++)
ListCountries[i].Print();
 
}
//_______________________________________________________________________
 
class Obrabotchik
{
private:
    Continent List_Continents[5];
 
public:
    Obrabotchik();
    ~Obrabotchik();
 
    Continent GetListContinents (int i);
    void SetListContinents();
      
//  void Sort_po_plosh(int k);
};
 
Obrabotchik::Obrabotchik()
{
// printf("\n \n Obr Constructor without params used\n\n");
}
 
Obrabotchik::~Obrabotchik()
{
//printf("\nObr Destructor used\n\n");
}
 
 
Continent Obrabotchik::GetListContinents (int i)
{
    return List_Continents[i];
}
/*
void Obrabotchik::Sort_po_plosh(int k)
{
int i,j,imin=0;float min=10000,a=0;
 
Country b[6],temp,min;
 
for (i=0;i<n;i++)
b=List_Continents[i].GetListCountries(int i);
 
for(i=0;i<n-1;i++)
{
  imin=i;
  min=b[i].GetPloshad();
  for(j=i+1;j<n;j++)
  {
    a=b[j].GetPloshad();
    if(a<min){
              imin=j;
              min=b[j];
             }
  }
  b[imin]=b[i];
  b[i]=min;
}
 
for(i=0;i<n;i++)
{
  pfintf("%s\n",b[i].GetName_Country());
  printf("%f\n",b[i].GetNaselenije());
  printf("%f\n",b[i].GetPloshad());
  printf("%s\n",b[i].GetForma_Pravl());
}
}*/
 
void SetListContinents()
{
Obrabotchik k;
Continent temp[5];
Country temp_c[8];
 
char c[20];
 
 
 
     for(int i=0;i<m;i++)
     {
     temp[i]=k.GetListContinents(i);
     
     strcpy(c,"Name_Continent");
     
     temp[i].SetName_Continent(c);
     for(int j=0;j<n;j++)
     {
      temp_c[j]=temp[i].GetListCountries(j);
      
      strcpy(c,"name_Country");
      
      temp_c[j].SetName_Country(c);
      temp_c[j].SetPloshad(12345+i);
      temp_c[j].SetNaselenije(64516+i);
 
      strcpy(c,"Form");
 
      temp_c[j].SetForma_Pravl(c);
     }
     }
     
     
     for(int i=0;i<m;i++)
     {
     printf("%s\n",temp[i].GetName_Continent());
     for(int j=0;j<n;j++)
     {
      temp_c[j]=temp[i].GetListCountries(j);
      printf("%s\t",temp_c[j].GetName_Country());
      printf("%.1f\t",temp_c[j].GetNaselenije());
      printf("%.1f\t",temp_c[j].GetPloshad());
      printf("%s\n",temp_c[j].GetForma_Pravl());
     }        
     }
}
 
int main()
{
    {
    char name[30]={0};
    char form[30]={0};
    char name_Cont[30]={0};
    
    strcpy(name,"Country_name_1");
    strcpy(form,"Country_form_1");
    
     Obrabotchik A;
     
     A.SetListContinents();
          
    }
    //system("pause");
    getch();
    return 0;
}
0
IT_Exp
Эксперт
34794 / 4073 / 2104
Регистрация: 17.06.2006
Сообщений: 32,602
Блог
19.10.2012, 15:32
Ответы с готовыми решениями:

Программа выдает ошибку при компиляции на dev c++
#include &lt;iostream&gt; #include &lt;ctime&gt; using namespace std; int main() { srand(time(NULL)); int *arr; int...

Выдает ошибку при компиляции
#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; typedef struct _SLine { double start; double end; double length() { return...

Почему выдает такую ошибку? c++ при компиляции
Вот код программы, нахождение наибольшего числа с 3 заданных #include &lt;iostream&gt; uisng namespace std; int max(int a,int b) ...

10
545 / 344 / 12
Регистрация: 05.11.2010
Сообщений: 1,076
Записей в блоге: 1
19.10.2012, 15:37
Строка 276, void Obrabotchik::SetListContinents()
P.S. Не называй классы транслитом.
0
2 / 2 / 2
Регистрация: 05.07.2012
Сообщений: 99
19.10.2012, 15:42  [ТС]
Герц, просто поменять название класса?
0
 Аватар для defer
577 / 256 / 18
Регистрация: 29.11.2010
Сообщений: 868
19.10.2012, 15:45
реализация void SetListContinents() с классом не связана
0
2 / 2 / 2
Регистрация: 05.07.2012
Сообщений: 99
19.10.2012, 15:50  [ТС]
defer, я еще особо с классами на разобралась..можешь написать что и как исправить?
0
 Аватар для defer
577 / 256 / 18
Регистрация: 29.11.2010
Сообщений: 868
19.10.2012, 15:51
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
void Obrabotchik::SetListContinents()
{
Obrabotchik k;
Continent temp[5];
Country temp_c[8];
 
char c[20];
 
 
 
     for(int i=0;i<m;i++)
     {
     temp[i]=k.GetListContinents(i);
     
     strcpy(c,"Name_Continent");
     
     temp[i].SetName_Continent(c);
     for(int j=0;j<n;j++)
     {
      temp_c[j]=temp[i].GetListCountries(j);
      
      strcpy(c,"name_Country");
      
      temp_c[j].SetName_Country(c);
      temp_c[j].SetPloshad(12345+i);
      temp_c[j].SetNaselenije(64516+i);
 
      strcpy(c,"Form");
 
      temp_c[j].SetForma_Pravl(c);
     }
     }
     
     
     for(int i=0;i<m;i++)
     {
     printf("%s\n",temp[i].GetName_Continent());
     for(int j=0;j<n;j++)
     {
      temp_c[j]=temp[i].GetListCountries(j);
      printf("%s\t",temp_c[j].GetName_Country());
      printf("%.1f\t",temp_c[j].GetNaselenije());
      printf("%.1f\t",temp_c[j].GetPloshad());
      printf("%s\n",temp_c[j].GetForma_Pravl());
     }        
     }
}
1
2 / 2 / 2
Регистрация: 05.07.2012
Сообщений: 99
19.10.2012, 15:55  [ТС]
defer, спасибо.. а можешь еще подсказать почему не работает функция strcmp?
0
 Аватар для defer
577 / 256 / 18
Регистрация: 29.11.2010
Сообщений: 868
19.10.2012, 15:58
Цитата Сообщение от Levenyatko Посмотреть сообщение
функция strcmp
Приведи код где функция используется и ошибки которые возникают
0
2 / 2 / 2
Регистрация: 05.07.2012
Сообщений: 99
19.10.2012, 16:01  [ТС]
defer,


if(strcmp((char*)ListCountries[k].GetName_Country(), "one")==0){}

просто при компиляции на этой функции останавливается выполнение программы и выскакивает JIT-отладчик из Visual Studio
0
 Аватар для defer
577 / 256 / 18
Регистрация: 29.11.2010
Сообщений: 868
19.10.2012, 16:40
Цитата Сообщение от Levenyatko Посмотреть сообщение
if(strcmp((char*)ListCountries[k].GetName_Country(), "one")==0){}
Тут не понятен смысл функции char GetName_Country();, поясни что она должна делать?
0
2 / 2 / 2
Регистрация: 05.07.2012
Сообщений: 99
19.10.2012, 18:06  [ТС]
defer, мне нужно удалить из списка страну..ее нужно искать по названию.. GetName_Country() просто возвращает имя страны..по крайней мере должна возвращать..

Добавлено через 55 минут
я нашла))) спасибо..ошибка была именно в GetName_Country()
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
BasicMan
Эксперт
29316 / 5623 / 2384
Регистрация: 17.02.2009
Сообщений: 30,364
Блог
19.10.2012, 18:06
Помогаю со студенческими работами здесь

Выдает ошибку при компиляции. Не могу понять почему
Помогите с кодом. Я вижу что ошибка уровня самых низов но не могу понять все равно что тут не так. Вот эта ошибка: // error...

При компиляции выдает ошибку E2314 Call of nonfunction Full
Всем привет) при компиляции выдает ошибку E2314 Call of nonfunction Full #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include...

Подскажите пожалуйста в чем может быть трабл при компиляции класса выдает ошибку
Подскажите пожалуйста в чем может быть проблема: при компиляции класса выдает ошибку: (Ошибка LNK2001 неразрешенный внешний символ...

Программа выдает ошибку при работе с символьным массивом
Решил замутить такую игрульку. Суть проста: дана карта 15х15, необходимо на этой карте отыскать данную точку с произвольными координатами...

Программа работает, но при выводе определенной комбинации выдает ошибку
Помогите начинающему программисту :) Программа работает, но если ввести все непростые числа, то выдает ошибку &quot;поврежденная...


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

Или воспользуйтесь поиском по форуму:
11
Ответ Создать тему
Новые блоги и статьи
SDL3 для Web (WebAssembly): Реализация движения на Box2D v3 - трение и коллизии с повёрнутыми стенами
8Observer8 20.02.2026
Содержание блога Box2D позволяет легко создать главного героя, который не проходит сквозь стены и перемещается с заданным трением о препятствия, которые можно располагать под углом, как верхнее. . .
Конвертировать закладки radiotray-ng в m3u-плейлист
damix 19.02.2026
Это можно сделать скриптом для PowerShell. Использование . \СonvertRadiotrayToM3U. ps1 <path_to_bookmarks. json> Рядом с файлом bookmarks. json появится файл bookmarks. m3u с результатом. # Check if. . .
Семь CDC на одном интерфейсе: 5 U[S]ARTов, 1 CAN и 1 SSI
Eddy_Em 18.02.2026
Постепенно допиливаю свою "многоинтерфейсную плату". Выглядит вот так: https:/ / www. cyberforum. ru/ blog_attachment. php?attachmentid=11617&stc=1&d=1771445347 Основана на STM32F303RBT6. На борту пять. . .
Камера Toupcam IUA500KMA
Eddy_Em 12.02.2026
Т. к. у всяких "хикроботов" слишком уж мелкий пиксель, для подсмотра в ESPriF они вообще плохо годятся: уже 14 величину можно рассмотреть еле-еле лишь на экспозициях под 3 секунды (а то и больше),. . .
И ясному Солнцу
zbw 12.02.2026
И ясному Солнцу, и светлой Луне. В мире покоя нет и люди не могут жить в тишине. А жить им немного лет.
«Знание-Сила»
zbw 12.02.2026
«Знание-Сила» «Время-Деньги» «Деньги -Пуля»
SDL3 для Web (WebAssembly): Подключение Box2D v3, физика и отрисовка коллайдеров
8Observer8 12.02.2026
Содержание блога Box2D - это библиотека для 2D физики для анимаций и игр. С её помощью можно определять были ли коллизии между конкретными объектами и вызывать обработчики событий столкновения. . . .
SDL3 для Web (WebAssembly): Загрузка PNG с прозрачным фоном с помощью SDL_LoadPNG (без SDL3_image)
8Observer8 11.02.2026
Содержание блога Библиотека SDL3 содержит встроенные инструменты для базовой работы с изображениями - без использования библиотеки SDL3_image. Пошагово создадим проект для загрузки изображения. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru