blarg?

The Gorm Shortage

“You are completely gormless. You are devoid of gorm. You, sir, are gorm-free.”
- Harold, “The Red Green Show”

Having shaved my goatee for the first time since, well, since it started coming all the way in, I am absolutely not going to do this again. I kept a “soul tag”, that bit under the lower lip, very briefly. Arlene refused to allow my face anywhere near her, claiming I had a repugnant air of pretentious-artisteness, so that was the end of that. Now, it is all gone, and I am left looking like a man who has a misplaced his gorm. Not a happy day, not at all. I’m looking forward to having Evil Mike back.


My laptop has forsaken me, for reasons that I do not clearly understand.


mhoye@Protagonist:/usr/src/409$ mpicc planets.c

planets.o(.text+0x1a): In function `force':

: undefined reference to `pow'

planets.o(.text+0x35): In function `force':

: undefined reference to `pow'

planets.o(.text+0x55): In function `force':

: undefined reference to `pow'

planets.o(.text+0x60): In function `force':

: undefined reference to `sqrt'

planets.o(.text+0x8b): In function `force':

: undefined reference to `pow'

collect2: ld returned 1 exit status

mhoye@Protagonist:/usr/src/409$ _

And yet, #include <math.h> is right there at the top of my code. Fuck.

I’ve got nothing; splint tells me I’ve been a good boy, gcc –verbose tells me that I’m looking for math.h in /usr/include, and math.h is not too good for its home, so I’m stuck. I’m clearly not smart enough to fix this; examining math.h tells me that what I really want is bits/mathcalls.h somewhere, correctly included in math.h as far as I can tell, and I suspect that figuring out what’s wrong is going to be a lot worse than I am currently geared up to appreciate.

It’s weird – the more basic stuff seems to be when it breaks, the deeper your understanding needs to be to fix it.

Whoops: fixed. Adding “-lm” as a command-line compiler option is apparently the way to go. I don’t understand why I’d need to specify that; don’t I get that stuff automagically, after I #include it?

Straaange.

One Comment | Skip to comment form

  1. Mike Bruce

    I was going to tell you what was wrong, but you already found it.

    No, including the headers doesn’t help out with ld. Remember that compiling and linking are different phases in C, even though gcc kind of smooths over that for you. Roughly speaking, the header files provide definitions so everything checks out with the compiler, then you need to specify the necessary libraries to ld so it can load the implementations of the functions listed in the header files.

    More or less. There are probably some technical inaccuracies up there, but it’s probably all of the operational understanding you need.

    I feel a kind of disappointment towards anyone who can cultivate reasonable facial hair and then chooses not to.