#+BEGIN_SRC C
#include <stdio.h>
#include <math.h>
/* define complex struct */
struct complex_struct {
double x, y;
};
/* some helper functions on complex struct */
double real_part(struct complex_struct z) {
return z.x;
}
double img_part(struct complex_struct z) {
return z.y;
}
double magnitude(struct complex_struct z) {
return sqrt(z.x * z.x + z.y * z.y);
}
double angle(struct complex_struct z) {
return atan2(z.y, z.x);
}
/* helper functions to construct complex variable */
struct complex_struct make_from_real_img(double x, double y) {
struct complex_struct z;
z.x = x;
z.y = y;
return z;
}
struct complex_struct make_from_mag_ang(double r, double A) {
struct complex_struct z;
z.x = r * cos(A);
z.y = r * sin(A);
return z;
}
/* implement complex arithemtic */
struct complex_struct add_complex(struct complex_struct z1, struct complex_struct z2) {
return make_from_real_img(real_part(z1) + real_part(z2), img_part(z1) + img_part(z2));
}
int main(int argc, char *argv[]) {
struct complex_struct z1, z2 = {1.1, 2.4};
struct complex_struct z;
z = add_complex(z1, z2);
printf("%f", z);
return 0;
}
#+END_SRC
But evaluate it got error:
```
/tmp/cckFlXlJ.o: In function `magnitude':
C-src-18467gDZ.c:(.text+0xa8): undefined reference to `sqrt'
/tmp/cckFlXlJ.o: In function `angle':
C-src-18467gDZ.c:(.text+0xfe): undefined reference to `atan2'
/tmp/cckFlXlJ.o: In function `make_from_mag_ang':
C-src-18467gDZ.c:(.text+0x174): undefined reference to `cos'
C-src-18467gDZ.c:(.text+0x190): undefined reference to `sin'
collect2: error: ld returned 1 exit status
zsh:1: no such file or directory: /tmp/babel-18467-Yn/C-bin-18467tNf
```
So I think `ob-C.el` doesn't support to load included header files.