Форум программистов, компьютерный форум, киберфорум
C++ Builder
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.92/13: Рейтинг темы: голосов - 13, средняя оценка - 4.92
0 / 0 / 0
Регистрация: 17.03.2019
Сообщений: 14

[Linker Error] Unresolved external '_workSpace' referenced from D:\LABA\PROJECT1.OBJ

20.03.2019, 12:59. Показов 2808. Ответов 10
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
[Linker Error] Unresolved external '_workSpace' referenced from D:\LABA\PROJECT1.OBJ
[Linker Error] Unresolved external 'TworkSpace' referenced from D:\LABA\PROJECT1.OBJ
Что за _workSpace и TworkSpace ?
Как исправить эти ошибки?
0
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
20.03.2019, 12:59
Ответы с готовыми решениями:

Ошибка [Linker Error] Unresolved external '_Form1' referenced from G\.obj
Как устранить ошибку? файл .cpp //--------------------------------------------------------------------------- #include...

[Linker Error] Unresolved external 'f2(double)' referenced from D:\C++\4\UNIT1.OBJ-C++ Builder
что может означать эта ошибка: Unresolved external 'f2(double)' referenced from D:\C++\4\UNIT1.OBJ ...

[Linker Error] Unresolved external 'Sum(float)' referenced from D:\УЧЕБА\UNIT1.OBJ
что может означать эта ошибка Unresolved external 'Sum(float)' referenced from D:\УЧЕБА\UNIT1.OBJ ...

10
65 / 31 / 18
Регистрация: 16.03.2019
Сообщений: 84
20.03.2019, 13:22
Здравствуйте,

воспользуйтесь поиском по файлам проекта
Пункты меню Search->Find In Files.

Добавлено через 5 минут
Скорее всего у вас есть переменные _workSpace и TworkSpace, объявленные в PROJECT1.h
как extern, при том, что в .cpp они отсутствуют.
1
0 / 0 / 0
Регистрация: 17.03.2019
Сообщений: 14
20.03.2019, 13:24  [ТС]
Цитата Сообщение от Ctty Посмотреть сообщение
Search->Find In Files
На запрос TworkSpace указывает на эту часть кода. Не пойму, что не так ?
Application->CreateForm(__classid(TworkSpace), &workSpace);

На запрос _workSpace не реагирует - пишет не найден запрос
0
65 / 31 / 18
Регистрация: 16.03.2019
Сообщений: 84
20.03.2019, 13:44
Как объявлен TworkSpace?

кусок куда прилепите сюда.

Добавлено через 17 минут
Найдите файл .h, где объявлен класс TworkSpace

после объявления класса должна быть строчка
extern PACKAGE TworkSpace*workSpace;

А в .cpp файле должна быть строчка:
TworkSpace* workSpace;

Вот этой строчки скорее всего нет.
0
0 / 0 / 0
Регистрация: 17.03.2019
Сообщений: 14
20.03.2019, 15:51  [ТС]
Цитата Сообщение от Ctty Посмотреть сообщение
кусок куда прилепите сюда
Я вовсе запутался...

Unit1.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
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Grids.hpp>
#include <ExtCtrls.hpp>
#include <Dialogs.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
        TStringGrid *StringGrid1;
        TStringGrid *StringGrid2;
        TStringGrid *StringGrid3;
        TButton *Button1;
        TButton *Button2;
        TButton *Button3;
        TButton *Button4;
        TLabel *Label1;
        TButton *Button5;
        TLabel *Label2;
        TLabel *Label3;
        TComboBox *ComboBox2;
        TComboBox *ComboBox3;
        TLabel *Label4;
        TLabel *Label5;
        TComboBox *ComboBox4;
        TComboBox *ComboBox5;
        TButton *Button6;
        TButton *Button7;
        TOpenDialog *OpenDialog1;
        TSaveDialog *SaveDialog1;
        TComboBox *ComboBox6;
        TButton *Button8;
        void __fastcall Button5Click(TObject *Sender);
        void __fastcall ComboBox2Change(TObject *Sender);
        void __fastcall ComboBox3Change(TObject *Sender);
        void __fastcall ComboBox4Change(TObject *Sender);
        void __fastcall ComboBox5Change(TObject *Sender);
        void __fastcall Button4Click(TObject *Sender);
        void __fastcall Button6Click(TObject *Sender);
        void __fastcall Button7Click(TObject *Sender);
        void __fastcall Button2Click(TObject *Sender);
        void __fastcall Button1Click(TObject *Sender);
        void __fastcall Button3Click(TObject *Sender);
        void __fastcall ComboBox6Change(TObject *Sender);
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall TworkSpace(TObject *Sender);
 
private:    // User declarations
        void __fastcall LoadTable(TStringGrid *Grid);
        void __fastcall TForm1::SaveTable(TStringGrid *Grid);
public:     // User declarations
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif


Project1.cpp:

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
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("Unit1.cpp", workSpace);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
        try
        {
                 Application->Initialize();
                 Application->CreateForm(__classid(TworkSpace), &workSpace);
                 Application->Run();
        }
        catch (Exception &exception)
        {
                 Application->ShowException(&exception);
        }
        catch (...)
        {
                 try
                 {
                         throw Exception("");
                 }
                 catch (Exception &exception)
                 {
                         Application->ShowException(&exception);
                 }
        }
        return 0;
}
//---------------------------------------------------------------------------
0
65 / 31 / 18
Регистрация: 16.03.2019
Сообщений: 84
20.03.2019, 17:24
В файле Unit1.cpp (вы его не показали). Проверьте наличие строк:

C++
1
2
3
4
#include "Unit1.h"
 
 
TForm1 *Form1;
0
0 / 0 / 0
Регистрация: 17.03.2019
Сообщений: 14
20.03.2019, 17:52  [ТС]
Цитата Сообщение от Ctty Посмотреть сообщение
Unit1.cpp (вы его не показали)
Unit1.cpp:

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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
//---------------------------------------------------------------------------
 
#include <vcl.h>
#pragma hdrstop
 
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
int i,j,n,s,**k;
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
    Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox2Change(TObject *Sender)
{
    switch (ComboBox2->ItemIndex)
    {
        case 0:
        StringGrid1->RowCount = 3;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
 
        case 1:
        StringGrid1->RowCount = 4;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
 
        case 2:
        StringGrid1->RowCount = 5;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
 
        case 3:
        StringGrid1->RowCount = 6;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }break;
 
        case 4:
        StringGrid1->RowCount = 7;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
        
        case 5:
        StringGrid1->RowCount = 8;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox3Change(TObject *Sender)
{
    switch (ComboBox3->ItemIndex)
    {
        case 0:
        StringGrid1->ColCount = 3;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
 
        case 1:
        StringGrid1->ColCount = 4;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
 
        case 2:
        StringGrid1->ColCount = 5;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
 
        case 3:
        StringGrid1->ColCount = 6;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
 
        case 4:
        StringGrid1->ColCount = 7;
        for(i = 1;i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
 
        case 5:
        StringGrid1->ColCount = 8;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox4Change(TObject *Sender)
{
    switch (ComboBox4->ItemIndex)
    {
        case 0:
        StringGrid2->RowCount = 3;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
 
        case 1:
        StringGrid2->RowCount = 4;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
 
        case 2:
        StringGrid2->RowCount = 5;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
 
        case 3:
        StringGrid2->RowCount = 6;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
 
        case 4:
        StringGrid2->RowCount = 7;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
 
        case 5:
        StringGrid2->RowCount = 8;
        for(i = 1; i<8; i++)
        {
            StringGrid1->Cells[0][i] = i;
            StringGrid1->Cells[i][0] = i;
            StringGrid2->Cells[0][i] = i;
            StringGrid2->Cells[i][0] = i;
            StringGrid3->Cells[0][i] = i;
            StringGrid3->Cells[i][0] = i;
        }
        break;
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox5Change(TObject *Sender)
{
switch (ComboBox5->ItemIndex)
{
    case 0:
    StringGrid2->ColCount = 3;
    for(i = 1; i<8; i++)
    {
        StringGrid1->Cells[0][i] = i;
        StringGrid1->Cells[i][0] = i;
        StringGrid2->Cells[0][i] = i;
        StringGrid2->Cells[i][0] = i;
        StringGrid3->Cells[0][i] = i;
        StringGrid3->Cells[i][0] = i;
    }
    break;
 
    case 1:
    StringGrid2->ColCount = 4;
    for(i = 1; i<8; i++)
    {
        StringGrid1->Cells[0][i] = i;
        StringGrid1->Cells[i][0] = i;
        StringGrid2->Cells[0][i] = i;
        StringGrid2->Cells[i][0] = i;
        StringGrid3->Cells[0][i] = i;
        StringGrid3->Cells[i][0] = i;
    }
    break;
 
    case 2:
    StringGrid2->ColCount = 5;
    for(i = 1; i<8; i++)
    {
        StringGrid1->Cells[0][i] = i;
        StringGrid1->Cells[i][0] = i;
        StringGrid2->Cells[0][i] = i;
        StringGrid2->Cells[i][0] = i;
        StringGrid3->Cells[0][i] = i;
        StringGrid3->Cells[i][0] = i;
    }
    break;
 
    case 3:
    StringGrid2->ColCount = 6;
    for(i = 1; i<8; i++)
    {
        StringGrid1->Cells[0][i] = i;
        StringGrid1->Cells[i][0] = i;
        StringGrid2->Cells[0][i] = i;
        StringGrid2->Cells[i][0] = i;
        StringGrid3->Cells[0][i] = i;
        StringGrid3->Cells[i][0] = i;
    }
    break;
 
    case 4:
    StringGrid2->ColCount = 7;
    for(i = 1; i<8; i++)
    {
        StringGrid1->Cells[0][i] = i;
        StringGrid1->Cells[i][0] = i;
        StringGrid2->Cells[0][i] = i;
        StringGrid2->Cells[i][0] = i;
        StringGrid3->Cells[0][i] = i;
        StringGrid3->Cells[i][0] = i;
    }
    break;
 
    case 5:
    StringGrid2->ColCount = 8;
    for(i = 1; i<8; i++)
    {
        StringGrid1->Cells[0][i] = i;
        StringGrid1->Cells[i][0] = i;
        StringGrid2->Cells[0][i] = i;
        StringGrid2->Cells[i][0] = i;
        StringGrid3->Cells[0][i] = i;
        StringGrid3->Cells[i][0] = i;
    }
    break;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
    if (SaveDialog1->Execute())
    {
        int f;
        f = FileCreate(SaveDialog1->FileName);
        if (f != -1)
        {
            for (int i = 0; i < StringGrid2->RowCount; i++)
            {
                AnsiString st = StringGrid2->Rows[i]->DelimitedText + "\r\n";
                FileWrite(f, st.c_str(), st.Length());
            }
            FileClose(f);
        }
        else
        {
            ShowMessage("Ошибка доступа");
        }
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button6Click(TObject *Sender)
{
    for(i = 1; i<StringGrid1->ColCount; i++)
        for(j = 1; j<StringGrid1->RowCount; j++)
            StringGrid1->Cells[i][j] = ' ';
 
    for(i = 1; i<8; i++)
    {
        StringGrid1->Cells[0][i] = i;
        StringGrid1->Cells[i][0] = i;
        StringGrid2->Cells[0][i] = i;
        StringGrid2->Cells[i][0] = i;
        StringGrid3->Cells[0][i] = i;
        StringGrid3->Cells[i][0] = i;
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button7Click(TObject *Sender)
{
    for(i = 1; i<StringGrid2->ColCount; i++)
        for(j = 1; j<StringGrid2->RowCount; j++)
            StringGrid2->Cells[i][j] = ' ';
 
    for(i = 1;i<8;i++)
    {
        StringGrid1->Cells[0][i] = i;
        StringGrid1->Cells[i][0] = i;
        StringGrid2->Cells[0][i] = i;
        StringGrid2->Cells[i][0] = i;
        StringGrid3->Cells[0][i] = i;
        StringGrid3->Cells[i][0] = i;
    }
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
    if (SaveDialog1->Execute())
    {
        int f;
        f = FileCreate(SaveDialog1->FileName);
        if (f != -1)
        {
            for (int i = 0; i < StringGrid1->RowCount; i++)
            {
                AnsiString st = StringGrid1->Rows[i]->DelimitedText + "\r\n";
                FileWrite(f, st.c_str(), st.Length());
            }
            FileClose(f);
        }
        else
        {
            ShowMessage("Ошибка доступа");
        }
    }
}
//---------------------------------------------------------------------------
int GetLine(int f, AnsiString *st)
{
    unsigned char buf [256];
    unsigned char *p = buf;
    int n;
    int len=0;
    n = FileRead(f, p, 1);
    while(n != 0)
    {
        if (*p == '\r')
        {
            n = FileRead(f, p, 1);
            break;
        }
        len++;
        p++;
        n = FileRead(f, p, 1);
    }
    *p = '\0';
    if (len != 0 )
    st->printf("%s", buf);
    return len;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    for (int i = 0; i<StringGrid1->RowCount; i++)
    StringGrid1->Rows[i]->Clear();
    StringGrid1->RowCount = 0;
    StringGrid1->ColCount = 0;
    if (OpenDialog1->Execute())
    {
        int f;
        AnsiString st;
        bool fl = true;
        f = FileOpen(OpenDialog1->FileName, fmOpenRead);
        if(f == -1) exit;
        while(GetLine(f, &st) != 0)
        {
            if (fl == true)
            {
                for (int i = 1; i<st.Length(); i++)
                if (st[i] == ',') StringGrid1->ColCount++;
                StringGrid1->Rows[StringGrid1->Row]->DelimitedText = st;
                fl = false;
                n = StringGrid1->ColCount;
                k = new int*[n];
                for(i = 0;i<n;i++)
                    k[i] = new int[n];
            }
            else
            {
                StringGrid1->RowCount++;
                StringGrid1->Row = StringGrid1->RowCount-1;
                StringGrid1->Rows[StringGrid1->Row]->DelimitedText = st;
            }
        }
        FileClose(f);
    }
    StringGrid1->FixedCols = 1;
    StringGrid1->FixedRows = 1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
    for (int i = 0; i<StringGrid1->RowCount; i++)
    StringGrid2->Rows[i]->Clear();
    StringGrid2->RowCount = 0;
    StringGrid2->ColCount = 0;
    if (OpenDialog1->Execute())
    {
        int f;
        AnsiString st;
        bool fl = true;
        f = FileOpen(OpenDialog1->FileName, fmOpenRead);
        if(f == -1) exit;
        while(GetLine(f,&st) != 0)
        {
            if (fl == true)
            {
                for (i = 1;i<st.Length();i++)
                if (st[i] == ',') StringGrid2->ColCount++;
                StringGrid2->Rows[StringGrid2->Row]->DelimitedText = st;
                fl = false;
                n = StringGrid2->ColCount;
                k = new int*[n];
                for(i = 0;i<n;i++)
                k[i] = new int[n];
            }
            else
            {
                StringGrid2->RowCount++;
                StringGrid2->Row = StringGrid2->RowCount-1;
                StringGrid2->Rows[StringGrid2->Row]->DelimitedText = st;
            }
        }
        FileClose(f);
    }
    StringGrid1->FixedCols = 1;
    StringGrid1->FixedRows = 1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox6Change(TObject *Sender)
{
    int a1[8][8],a2[8][8],a3[8][8],h,s;
 
    switch (ComboBox6->ItemIndex)
    {
        case 0:
        {
            for(i = 1; i<StringGrid1->ColCount; i++)
            {
                for(j = 1; j<StringGrid1->RowCount; j++)
                {
                    try
                    {
                        a1[i][j] = StrToInt(StringGrid1->Cells[i][j]);
                    }
                    catch (EConvertError&)
                    {
                        ShowMessage("Вы ввели неверный символ в первую матрицу он будет заменён на сумму строки и столбца");
                        StringGrid1->Cells[i][j] = i+j;
                    }
                }
            }
 
            for(i = 1; i<StringGrid2->ColCount; i++)
            {
                for(j = 1; j<StringGrid2->RowCount; j++)
                {
                    try
                    {
                        a2[i][j] = StrToInt(StringGrid2->Cells[i][j]);
                    }
                    catch (EConvertError&)
                    {
                        ShowMessage("Вы ввели неверный символ во вторую матрицу он будет заменён на сумму строки и столбца");
                        StringGrid2->Cells[i][j] = i+j;
                    }
                }
            }
 
            {
                if (StringGrid2->ColCount != StringGrid1->ColCount
                    || StringGrid2->RowCount != StringGrid1->RowCount)
                {
                    ShowMessage("Размер матриц не совпадает");
                }
                else
                {
                    StringGrid3->ColCount = StringGrid1->ColCount;
                    StringGrid3->RowCount = StringGrid1->RowCount;
                    for(i = 1; i<StringGrid3->ColCount; i++)
                    for(j = 1; j<StringGrid3->RowCount; j++)
                    StringGrid3->Cells[i][j] = IntToStr
                    (StrToInt(StringGrid1->Cells[i][j])+StrToInt(StringGrid2->Cells[i][j]));
                }
            }
        }
        break;
 
        case 1:
        {
            for(i = 1; i<StringGrid1->ColCount; i++)
            {
                for(j = 1; j<StringGrid1->RowCount; j++)
                {
                    try
                    {
                        a1[i][j] = StrToInt(StringGrid1->Cells[i][j]);
                    }
                    catch (EConvertError&)
                    {
                        ShowMessage("Вы ввели неверный символ в первую матрицу он будет заменён на разность строки и столбца");
                        StringGrid1->Cells[i][j] = i-j;
                    }
                }
            }
 
            for(i = 1; i<StringGrid2->ColCount; i++)
            {
                for(j = 1; j<StringGrid2->RowCount; j++)
                {
                    try
                    {
                        a2[i][j] = StrToInt(StringGrid2->Cells[i][j]);
                    }
                    catch (EConvertError&)
                    {
                        ShowMessage("Вы ввели неверный символ во вторую матрицу он будет заменён на разность строки и столбца");
                        StringGrid2->Cells[i][j] = i-j;
                    }
                }
            }
 
            {
                if(StringGrid2->ColCount != StringGrid1->ColCount
                   || StringGrid2->RowCount != StringGrid1->RowCount)
                {
                    ShowMessage("Размер матриц не совпадает");
                }
                else
                {
                    StringGrid3->ColCount = StringGrid1->ColCount;
                    StringGrid3->RowCount = StringGrid1->RowCount;
                    for(i = 1; i<StringGrid3->ColCount; i++)
                        for(j = 1; j<StringGrid3->RowCount; j++)
                            StringGrid3->Cells[i][j] = IntToStr(StrToInt(StringGrid1->Cells[i][j])+(-1)*
                                                                StrToInt(StringGrid2->Cells[i][j]));
                }
            }
        }
        break;
 
        case 2:
        {
            for(i = 1;i<StringGrid1->ColCount;i++)
            {
                for(j = 1;j<StringGrid1->RowCount;j++)
                {
                    try
                    {
                        a1[i][j] = StrToInt(StringGrid1->Cells[i][j]);
                    }
                    catch (EConvertError&)
                    {
                        ShowMessage("Вы ввели неверный символ в первую матрицу он будет заменён на произведение строки и столбца");
                        StringGrid1->Cells[i][j] = i*j;
                    }
                }
            }
 
            for(i = 1; i<StringGrid2->ColCount; i++)
            {
                for(j = 1; j<StringGrid2->RowCount; j++)
                {
                    try
                    {
                        a2[i][j] = StrToInt(StringGrid2->Cells[i][j]);
                    }
                    catch (EConvertError&)
                    {
                        ShowMessage("Вы ввели неверный символ во вторую матрицу он будет заменён на произведение строки и столбца");
                        StringGrid2->Cells[i][j] = i*j;
                    }
                }
            }
 
            {
                if(StringGrid1->ColCount != StringGrid2->RowCount)
                {
                    ShowMessage("Размер матриц не совпадает");
                }
                else
                {
                    StringGrid3->ColCount = StringGrid2->ColCount;
                    StringGrid3->RowCount = StringGrid1->RowCount;
                    for(i = 1; i<StringGrid3->ColCount; i++)
                    {
                        for(j = 1; j<StringGrid3->RowCount; j++)
                        {
                            s = 0;
                            for(h = 1; h<StringGrid2->RowCount; h++)
                                s = s + StrToInt(StringGrid1->Cells[h][i])*
                                    StrToInt(StringGrid2->Cells[j][h]);
                            StringGrid3->Cells[i][j] = IntToStr(s);
                        }
                    }
                }
            }
        }
        break;
    }
}
//---------------------------------------------------------------------------
0
65 / 31 / 18
Регистрация: 16.03.2019
Сообщений: 84
20.03.2019, 18:46
Лучший ответ Сообщение было отмечено Max12e3 как решение

Решение

Сразу не обратил внимание

В Project1.cpp у вас:
C++
1
2
3
USEFORM("Unit1.cpp", workSpace);
...
Application->CreateForm(__classid(TworkSpace), &workSpace);
Т.е. название класса формы в Unit1.h должно быть
TworkSpace, а переменная workSpace.

По факту в Unit1.h мы видим:
C++
1
2
3
class TForm1
....
extern PACKAGE TForm1 *Form1;
В Unit1.cpp
C++
1
TForm1 *Form1;
Попробуйте исправить строки в Project1.cpp:
C++
1
2
3
USEFORM("Unit1.cpp", workSpace);
...
Application->CreateForm(__classid(TworkSpace), &workSpace);
на:
C++
1
2
3
USEFORM("Unit1.cpp", Form1);
...
Application->CreateForm(__classid(TForm1), &Form1);
Предварительно копию проекта создайте.
1
0 / 0 / 0
Регистрация: 17.03.2019
Сообщений: 14
20.03.2019, 19:00  [ТС]
Цитата Сообщение от Ctty Посмотреть сообщение
Попробуйте исправить строки в Project1.cpp:
Теперь это..
[Linker Error] Unresolved external '__fastcall TForm1::FormCreate(System::TObject *)' referenced from C:\USERS\...\UNIT1.OBJ
0
65 / 31 / 18
Регистрация: 16.03.2019
Сообщений: 84
20.03.2019, 19:29
Лучший ответ Сообщение было отмечено Max12e3 как решение

Решение

Вы похоже руками имя класса формы правили???
(правьте в следующий раз свойство Name в Object Inspector)

В Unit1.h

есть:
C++
1
void __fastcall FormCreate(TObject *Sender);
а в Unit1.cpp этой функции я не увидел (проверьте).
(если нет - уберите строчку из Unit1.h)

Ещё могут быть несоответствия в файле формы Unit1.dfm....
1
0 / 0 / 0
Регистрация: 17.03.2019
Сообщений: 14
21.03.2019, 10:46  [ТС]
Цитата Сообщение от Ctty Посмотреть сообщение
если нет - уберите строчку из Unit1.h
Спасибо за помощь, все работает
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
21.03.2019, 10:46
Помогаю со студенческими работами здесь

Ошибка [Linker Error] Unresolved external 'TForm1::' referenced from C:\USERS\DESKTOP\PROJECT2.OBJ
//--------------------------------------------------------------------------- #include &lt;vcl.h&gt; #pragma hdrstop #include...

Подскажите что мне делать с ошибкой [Linker Error] Unresolved external 'Btsdk_Init()' referenced from UNIT1.OBJ
Здравствуйте, помогите пожалуйста. Скачал с сайта http://www.bluesoleil.com/ библиотеку для работы с блютуз. В нее входит 4-е h...

что за ошибка?[Linker Error] Unresolved external '_PortOut' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\UNIT1.OBJ
Unresolved external '_PortOut' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\PROJECTS\UNIT1.OBJ Я скачал библиотеку для работы с...

[Linker Error] Unresolved external '__fastcall TForm3::FormCreate(System::TObject *)' referenced from D:\Sasha\Navchannya\OPI\KPIZ\KPIZ\UNIT3.OBJ
Здравствуйте, уважаемые форумчане! У меня возникла проблема с компиляцией проекта. Дело в том, что при компиляции Билдер выдает мне...

[Linker Error] Unresolved external '_main' referenced
Не могу нормально скомпилировать обычный консольный код, в чём может быть проблема? и как её исправить? #ifndef QUEUE_H #define QUEUE_H...


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

Или воспользуйтесь поиском по форуму:
11
Ответ Создать тему
Новые блоги и статьи
Кто-нибудь знает, где можно бесплатно получить настольный компьютер или ноутбук? США.
Programma_Boinc 26.12.2025
Кто-нибудь знает, где можно бесплатно получить настольный компьютер или ноутбук? США. Нашел на реддите интересную статью под названием «Кто-нибудь знает, где получить бесплатный компьютер или. . .
Thinkpad X220 Tablet — это лучший бюджетный ноутбук для учёбы, точка.
Programma_Boinc 23.12.2025
Рецензия / Мнение/ Перевод Нашел на реддите интересную статью под названием The Thinkpad X220 Tablet is the best budget school laptop period . Ниже её машинный перевод. Thinkpad X220 Tablet —. . .
PhpStorm 2025.3: WSL Terminal всегда стартует в ~
and_y87 14.12.2025
PhpStorm 2025. 3: WSL Terminal всегда стартует в ~ (home), игнорируя директорию проекта Симптом: После обновления до PhpStorm 2025. 3 встроенный терминал WSL открывается в домашней директории. . .
Как объединить две одинаковые БД Access с разными данными
VikBal 11.12.2025
Помогите пожалуйста !! Как объединить 2 одинаковые БД Access с разными данными.
Новый ноутбук
volvo 07.12.2025
Всем привет. По скидке в "черную пятницу" взял себе новый ноутбук Lenovo ThinkBook 16 G7 на Амазоне: Ryzen 5 7533HS 64 Gb DDR5 1Tb NVMe 16" Full HD Display Win11 Pro
Музыка, написанная Искусственным Интеллектом
volvo 04.12.2025
Всем привет. Некоторое время назад меня заинтересовало, что уже умеет ИИ в плане написания музыки для песен, и, собственно, исполнения этих самых песен. Стихов у нас много, уже вышли 4 книги, еще 3. . .
От async/await к виртуальным потокам в Python
IndentationError 23.11.2025
Армин Ронахер поставил под сомнение async/ await. Создатель Flask заявляет: цветные функции - провал, виртуальные потоки - решение. Не threading-динозавры, а новое поколение лёгких потоков. Откат?. . .
Поиск "дружественных имён" СОМ портов
Argus19 22.11.2025
Поиск "дружественных имён" СОМ портов На странице: https:/ / norseev. ru/ 2018/ 01/ 04/ comportlist_windows/ нашёл схожую тему. Там приведён код на С++, который показывает только имена СОМ портов, типа,. . .
Сколько Государство потратило денег на меня, обеспечивая инсулином.
Programma_Boinc 20.11.2025
Сколько Государство потратило денег на меня, обеспечивая инсулином. Вот решила сделать интересный приблизительный подсчет, сколько государство потратило на меня денег на покупку инсулинов. . . .
Ломающие изменения в C#.NStar Alpha
Etyuhibosecyu 20.11.2025
Уже можно не только тестировать, но и пользоваться C#. NStar - писать оконные приложения, содержащие надписи, кнопки, текстовые поля и даже изображения, например, моя игра "Три в ряд" написана на этом. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2025, CyberForum.ru