I am currently implementing complex numbers in C. Somehow this error occurs if i want to run the programm:
edit: to compile I used:
gcc complex.c
./a.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users...\Temp\ccwM3Yew.o:complex.c:(.text+0x184): undefined reference to `addC'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users...\Temp\ccwM3Yew.o:complex.c:(.text+0x1a0): undefined reference to `printComplex' collect2.exe: error: ld returned 1 exit status
Main:
#include "library.h"
#include <stdio.h>
int main () {
    
    complex x, y;
    printf("type in re-part of first complex number:\n");
    scanf("%lf", &x.re);
    printf("type in im-part of first complex number:\n");
    scanf("%lf", &x.im);
    printf("type in re-part of second complex number:\n");
    scanf("%lf", &y.re);
    printf("type in im-part of second complex number:\n");
    scanf("%lf", &y.im);
    complex z = addC(x, y);
    printComplex(x);
    return 0;
}
library.h:
typedef struct {
    double re;
    double im;
} complex; 
complex addC(complex x, complex y);
complex subC(complex x, complex y);
complex divC(complex x, complex y);
complex multC(complex x, complex y);
void printComplex(complex a);
library.c:
#include "library.h"
#include <stdio.h>
complex addC(complex x, complex y) {
     complex z;
     z.re = (x.re + y.re);
     z.im = (x.im + y.im);
     return z;
}
complex subC(complex x, complex y) {
    complex z;
     z.re = (x.re - y.re);
     z.im = (x.im - y.im);
     return z;
}
complex divC(complex x, complex y) {
    //ToDo 
}
complex multC(complex x, complex y) {
    complex z;
     z.re = ((x.re*y.re)-(x.im*y.im));
     z.im = ((x.re*y.im)+(x.im*y.re));
     return z;
}
void printComplex(complex a) {
    printf("Die komplexe Zahl lauetet: %.3f + %.3fi", &a.re, &a.im);
}
thanks:)
