mohd-akram / st

C port of Ken Thompson's Space Travel
https://news.ycombinator.com/item?id=34664433
119 stars 13 forks source link

Linker issues #1

Closed larsbrinkhoff closed 1 year ago

larsbrinkhoff commented 1 year ago

Hello,

Great job, I'm excited to see this! (CC @sebras)

Using your Makefile, I get linker errors. This is the command and some of the messages.

cc   -lSDL2 -lSDL2_ttf  st.c   -o st
/usr/bin/ld: /tmp/ccISkhgJ.o: in function `vec':
st.c:(.text+0x25d): undefined reference to `SDL_SetRenderDrawColor'
/usr/bin/ld: st.c:(.text+0x295): undefined reference to `SDL_RenderDrawLine'
/usr/bin/ld: /tmp/ccISkhgJ.o: in function `chars':
st.c:(.text+0x3d3): undefined reference to `TTF_SetFontSize'

The problems are:

  1. The libraries need to go after st.c.
  2. The math library is needed.

I had success compiling using this command: cc st.c -lSDL2 -lSDL2_ttf -lm -o st

mohd-akram commented 1 year ago

Thank you! Your GRAPHIC-2 simulator was incredibly helpful and a lot of fun. The issue has been fixed via #3.