### Math function compile errors

I have a separate function called fun which takes an argument x and returns exp(sin(x))*cos(x/40). On my personal machine this compiles fine. I am including stdio.h, stdlib.h, and math.h at the top of the file.

When I attempt to compile on Euler I get errors:

- Code:
`[rmays@euler01 10Homework]$ gcc Integral.cpp -o integrate.out`

/tmp/ccQPSNFB.o: In function `fun(double)':

Integral.cpp:(.text+0x202): undefined reference to `sin'

Integral.cpp:(.text+0x207): undefined reference to `exp'

Integral.cpp:(.text+0x222): undefined reference to `cos'

/tmp/ccQPSNFB.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'

collect2: ld returned 1 exit status

I saw a suggestion that I should include the -lm flag at the end of my compilation line. Now I get a different error:

Any idea what's going on?

Thanks,

-Owen