Код: Выделить всё
c_source.hКод: Выделить всё
#include
#ifdef __cplusplus
extern "C"
{
#endif
double complex arg_d(double complex z);
#ifdef __cplusplus
}
#endif
Код: Выделить всё
c_source.cКод: Выделить всё
#include "c_source.h"
double complex arg_d(double complex z)
{
return carg(z);
}
Код: Выделить всё
#include "c_source.h"
int main()
{
std::complex result;
result = arg_d(5);
return 0;
}
Код: Выделить всё
In file included from cpp_source.cpp:1:
c_source.h:8:20: error: expected initializer before ‘arg_d’
8 | double complex arg_d(double complex z);
| ^~~~~
cpp_source.cpp: In function ‘int main()’:
cpp_source.cpp:6:14: error: ‘arg_d’ was not declared in this scope
6 | result = arg_d(5);
| ^~~~~
Подробнее здесь: https://stackoverflow.com/questions/798 ... types-in-c
Мобильная версия