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

[bcc32c Error] UComplex.h(60): no matching function for call to 'strcpy'

07.05.2024, 13:36. Показов 2507. Ответов 1

Студворк — интернет-сервис помощи студентам
Помогите пожалуйста - возникает ошибка в коде программы:
[bcc32c Error] UComplex.h(60): no matching function for call to 'strcpy'
_str.h(120): candidate function not viable: no known conversion from 'System::WideChar *' (aka 'wchar_t *') to 'const char *' for 2nd argument

Не знаю как это исправить. Замена на strcpy_s - не помогает. Аналогичная ситуация со strcat и прочими strcpy, что идут по тексту далее. Собираю в C++ Builder11

текст UComplex.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
#ifndef UNumberH
#define UNumberH
#include <vcl.h>
#include <math.h>
#include <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
//#include <cstring.h>
#include <cstring>
#endif
using namespace std;
 
/*Комплексное число TComplex - это неизменяемая пара вещественных чисел,
представляющие действительную и мнимую части комплексного числа (a + i*b).*/
class TComplex : public TObject  // Реализует комплексное число вида a +i* b (Re +i* Im)
{
    double cRe; // Действительная часть
    double cIm; // Мнимая часть
    String Get(void) const; // взять строка
    String GetRe(void) const; // взять Re строка
    String GetIm(void) const; // взять Im строка
public:
    // Конструктор
    TComplex(double ReTemp = 0, double ImTemp = 0) : cRe(ReTemp), cIm(ImTemp)
    {};
    TComplex(char str[]); // Конструктор
    //TComplex(string str[]); // Конструктор
    //Конструктор копирования
    //TComplex(const TComplex& P);
    TComplex(const TComplex& P);
    TComplex* operator + (const TComplex& T); // сложение
    TComplex* operator - (const TComplex& T); // вычитание
    TComplex* operator * (const TComplex& B); // умножение
    TComplex* operator / (const TComplex& B); // деление
    //void operator - (void){Re = -Re; Im = -Im;}; // минус
    TComplex* operator - (void); // минус
    TComplex* Square(void); // квадрат
    TComplex* Invert(void); // обратное
    double Magnitude(void); // модуль
    double AngleRad(void); // уголРад
    double AngleDeg(void); // уголГрад
    TComplex* Power(int n); // степень
    TComplex* Root(int n, int i); // корень n - степень; i - i-ый корень
    bool operator == (const TComplex& T); // равно
    __property double Re = { read = cRe, write = cRe }; // читать и писать Re
    __property double Im = { read = cIm, write = cIm }; // читать и писать Im
    __property String ReStr = { read = GetRe }; // читать Re (строка)
    __property String ImStr = { read = GetIm }; // читать Im (строка)
    __property String Complex = { read = Get }; // читает объект в формате строки
};
 
 
// взять Re строка
 String TComplex::GetRe(void) const
 {
     String ReTemp;
     char Res[10];
     ReTemp = FloatToStr(cRe);
     strcpy(Res, ReTemp.c_str());
     return Res;
 };
 
// Взять Im строка
String TComplex::GetIm(void) const
{
    String ImTemp;
    char Res[10];
    ImTemp = FloatToStr(cIm);
    strcpy(Res, ImTemp.c_str());
    return Res;
};
 
String TComplex::Get(void) const
{
    String ReTemp, ImTemp;
    char Res[23];
    ReTemp = FloatToStr(cRe);
    strcpy(Res, ReTemp.c_str());
    strcat(Res, "+i*");
    ImTemp = FloatToStr(cIm);
    strcat(Res, ImTemp.c_str());
    return Res;
};
 
// конструктор
TComplex::TComplex(char str[])
{
    cRe = StrToFloat(strtok(str, "+i*"));
    cIm = StrToFloat(strtok(NULL, "+i*"));
};
 
// конструктор копирования
TComplex::TComplex(const TComplex& P)
{
    Re = P.Re;
    Im = P.Im;
};
//прочие функции не важны, т.к. там нет ошибок
};
Текст PComplex
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
#include <vcl.h>
#pragma hdrstop
#include <iostream>
#include <stdarg.h>
#include <math.hpp>
#include <stdlib.h>
#include <stdio.h>
#include "UComplex.h"
 
#pragma argsused
using namespace std;
 
int main(int argc, char* argv[])
{
    SetConsoleCP(1251);
    SetConsoleOutputCP(1251);
    printf("Лабораторная работа #2\n");
    cout.setf(ios_base::boolalpha);
 
    TComplex* C0 = new TComplex();
    cout << "TComplex() -> " << C0->Complex.c_str() << endl; // 0+i*0
    TComplex* C1 = new TComplex(1, 2);
    cout << "TComplex(1, 2) -> " << C1->Complex.c_str() << endl; // 1+i*2
    TComplex* C2 = new TComplex(-1, 2);
    cout << "TComplex(-1, 2) -> " << C2->Complex.c_str() << endl; // -1+i*2
    TComplex* C3 = new TComplex(*C2);
    cout << "TComplex(C2) -> " << C3->Complex.c_str() << endl; // -1+i*2
    TComplex* C4 = C2;
    cout << "C4 = *C2 -> " << C4->Complex.c_str() << endl; // -1+i*2
    TComplex* C5 = new TComplex("-2+i*3");
    cout << "C5 = -2+i*3 -> " << C5->Complex.c_str() << endl; // -2+i*3
    TComplex* C6 = *C1 + *C2;
    cout << C1->Complex.c_str() << " + " << C2->Complex.c_str() << " = " << C6->Complex.c_str() << endl;
    TComplex* C7 = *C1 + *C0;
    cout << C1->Complex.c_str() << " + " << C0->Complex.c_str() << " = " << C7->Complex.c_str() << endl;
 
    TComplex* C8 = *C1 - *C2;
    cout << C1->Complex.c_str() << " - " << C2->Complex.c_str() << " = " << C8->Complex.c_str() << endl;
    TComplex* C9 = *C1 - *C0;
    cout << C1->Complex.c_str() << " - " << C0->Complex.c_str() << " = " << C9->Complex.c_str() << endl;
 
    TComplex* C10 = *C1 * *C2;
    cout << C1->Complex.c_str() << " * " << C2->Complex.c_str() << " = " << C10->Complex.c_str() << endl;
    TComplex* C11 = *C1 * *C0;
    cout << C1->Complex.c_str() << " * " << C0->Complex.c_str() << " = " << C11->Complex.c_str() << endl;
 
    TComplex* C12 = *C1 / *C2;
    cout << C1->Complex.c_str() << " / " << C2->Complex.c_str() << " = " << C12->Complex.c_str() << endl;
 
    cout << "Re(" << C1->Complex.c_str() << ") = " << C12->ReStr.c_str() << endl;
    cout << "Im(" << C1->Complex.c_str() << ") = " << C12->ReStr.c_str() << endl;
 
    TComplex* C13 = *C1 / *C0;
    cout << C1->Complex.c_str() << " / " << C0->Complex.c_str() << " = " << C13->Complex.c_str() << endl;
 
    TComplex* C14 = (*C1).Square();
    cout << C1->Complex.c_str() << "Square() = " << C14->Complex.c_str() << endl;
    TComplex* C15 = (*C2).Square();
    cout << C2->Complex.c_str() << "Square() = " << C15->Complex.c_str() << endl;
 
    TComplex* C16 = -*C1;
    cout << "-(" << C1->Complex.c_str() << ") = " << C16->Complex.c_str() << endl;
    TComplex* C17 = -*C2;
    cout << "-(" << C2->Complex.c_str() << ") = " << C17->Complex.c_str() << endl;
 
    TComplex* C18 = (*C0).Invert();
    cout << "1/(" << C0->Complex.c_str() << ") = " << C18->Complex.c_str() << endl;
    TComplex* C19 = (*C2).Invert();
    cout << "1/(" << C2->Complex.c_str() << ") = " << C19->Complex.c_str() << endl;
 
    bool b1 = ((*C1) == (*C2));
    cout << C1->Complex.c_str() << " == " << C2->Complex.c_str() << " ? " << b1 << endl;
    bool b2 = ((*C2) == (*C3));
    cout << C2->Complex.c_str() << " == " << C3->Complex.c_str() << " ? " << b2 << endl;
 
    double d1 = (*C0).Magnitude();
    cout << C0->Complex.c_str() << " .Magnitude() = " << d1 << endl;
    double d2 = (*C2).Magnitude();
    cout << C2->Complex.c_str() << " .Magnitude() = " << d2 << endl;
 
    double d3 = (*C0).AngleRad();
    cout << C0->Complex.c_str() << " AngleRad() = " << d3 << endl;
    double d4 = (*C2).AngleRad();
    cout << C2->Complex.c_str() << " AngleRad() = " << d4 << endl;
 
    double d5 = (*C0).AngleDeg();
    cout << C0->Complex.c_str() << " .AngleDeg() = " << d5 << endl;
    double d6 = (*C2).AngleDeg();
    cout << C2->Complex.c_str() << " .AngleDeg() = " << d6 << endl;
 
    TComplex* C20 = (*C1).Power(3);
    cout << C1->Complex.c_str() << ".Power(3) = " << C20->Complex.c_str() << endl;
    TComplex* C21 = (*C2).Power(2);
    cout << C2->Complex.c_str() << ".Power(2) = " << C21->Complex.c_str() << endl;
 
    TComplex* C22 = (*C1).Root(3, 2);
    cout << C1->Complex.c_str() << ".Root(3, 2) = " << C22->Complex.c_str() << endl;
    TComplex* C23 = (*C2).Root(3, 2);
    cout << C2->Complex.c_str() << ".Root(3, 2) = " << C23->Complex.c_str() << endl;
 
    system("pause");
    return 0;
};
0
IT_Exp
Эксперт
34794 / 4073 / 2104
Регистрация: 17.06.2006
Сообщений: 32,602
Блог
07.05.2024, 13:36
Ответы с готовыми решениями:

[bcc32c Error]: no matching function for call to 'strcpy'
#ifdef _WIN32 #include &lt;tchar.h&gt; #include &lt;vcl.h&gt; #include &lt;math.h&gt; #include &lt;stdio.h&gt; #include &lt;cstring&gt; #include &lt;string&gt; ...

Error: No matching function for call to
Доброго времени суток! Прошу помочь с проблемой, возникшей при компиляции данного кода, а именно: No matching function for call to ... ...

Ошибка error: no matching function for call to '.'
Всем привет. Так как моё изучение языка с++ началось недавно, пока не со всеми проблемами могу справиться. Помогите, пожалуйста. ...

1
 Аватар для Dinkin
783 / 556 / 136
Регистрация: 31.05.2013
Сообщений: 3,142
Записей в блоге: 3
07.05.2024, 17:05
Доброго....
Тут
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
BasicMan
Эксперт
29316 / 5623 / 2384
Регистрация: 17.02.2009
Сообщений: 30,364
Блог
07.05.2024, 17:05
Помогаю со студенческими работами здесь

Ошибка: "no matching function for call to strcpy"
Ошибка на strcpy. Все перепробовал. В чем причина? //--------------------------------------------------------------------------- ...

Error: no matching function for call to 'std::basic_string<char>::find
if (find(Op.begin(), Op.end(), 'V') != Op.end() &amp;&amp; expression!=&quot;exp&quot;) { while (find(Op.begin(),...

Error: no matching function for call to 'tan(float&, int)'
#include &lt;iostream&gt; #include &lt;cmath&gt; using namespace std; int main() { float x,A,Z,B,Betta, *a; int n,...

Поиск палиндрома. Итераторы. [ error: no matching function for call to ‘copy_if . ' ]
Здравствуйте. Задача поиска палиндрома (выражения, в котором не имеет значение направление чтения букв). Сказано, чтобы не буквы...

error: no matching function for call to ‘pow(, int)’ Выдает ошибку. Пересобирал код, так и не могу понять, где ошибка
#include &lt;iostream&gt; #include&lt;cmath&gt; using namespace std; int main(){ float x,z,y,c,G; cout&lt;&lt;&quot;x:&quot;;cin&gt;&gt;x; ...


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

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
Новые блоги и статьи
Thinkpad X220 Tablet — это лучший бюджетный ноутбук для учёбы, точка.
Programma_Boinc 23.12.2025
Thinkpad X220 Tablet — это лучший бюджетный ноутбук для учёбы, точка. Рецензия / Мнение/ Перевод https:/ / **********/ gallery/ thinkpad-x220-tablet-porn-gzoEAjs . . .
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 - писать оконные приложения, содержащие надписи, кнопки, текстовые поля и даже изображения, например, моя игра "Три в ряд" написана на этом. . .
Мысли в слух
kumehtar 18.11.2025
Кстати, совсем недавно имел разговор на тему медитаций с людьми. И обнаружил, что они вообще не понимают что такое медитация и зачем она нужна. Самые базовые вещи. Для них это - когда просто люди. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2025, CyberForum.ru