# Undefined reference to drawString et al

**URL:** <https://discourse.libsdl.org/t/undefined-reference-to-drawstring-et-al/11587>\
**Category:** SDL Development\
**Created:** [December 7, 2004, 6:50pm UTC](https://discourse.libsdl.org/t/undefined-reference-to-drawstring-et-al/11587 "2004-12-07T18:50:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![G\_B](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/g/779978/32.png) [@G\_B](https://discourse.libsdl.org/u/G_B)\
**Post date:** [December 7, 2004, 6:50pm UTC](https://discourse.libsdl.org/t/undefined-reference-to-drawstring-et-al/11587/1 "2004-12-07T18:50:29Z")

</div>

I compile SDL tutorials with g++ lesson4.cpp -lSDL  
-lSDLmail on Linux and I get undefined reference  
errors for

drawString  
stringWidth  
freeFont  
initFont

are these in some SDL library I didn’t link? The  
tutorial code doesn’t define them.

The tutorials giving the problem are lessons 4 and 5  
at  
[http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/index](http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/index)

Thanks,  
GB\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
Do you Yahoo!?  
The all-new My Yahoo! - Get yours free!  
[http://my.yahoo.com](http://my.yahoo.com)

---

<div class="post-metadata">

**Author:** ![G\_B](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/g/779978/32.png) [@G\_B](https://discourse.libsdl.org/u/G_B)\
**Post date:** [December 7, 2004, 7:15pm UTC](https://discourse.libsdl.org/t/undefined-reference-to-drawstring-et-al/11587/2 "2004-12-07T19:15:21Z")

</div>

Oops, I forgot to link to font.o file which did have  
the functions defined.

— G B \<@G\_B\> wrote:

> I compile SDL tutorials with g++ lesson4.cpp -lSDL  
> -lSDLmail on Linux and I get undefined reference  
> errors for
> 
> drawString  
> stringWidth  
> freeFont  
> initFont
> 
> are these in some SDL library I didn’t link? The  
> tutorial code doesn’t define them.
> 
> The tutorials giving the problem are lessons 4 and 5  
> at

[http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/index](http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/index)\>

> Thanks,  
> GB
> 
> * * *
> 
> Do you Yahoo!?  
> The all-new My Yahoo! - Get yours free!  
> [http://my.yahoo.com](http://my.yahoo.com)
> 
> * * *
> 
> SDL mailing list  
> SDL at [libsdl.org](http://libsdl.org)  
> [http://www.libsdl.org/mailman/listinfo/sdl](http://www.libsdl.org/mailman/listinfo/sdl)

* * *

Do You Yahoo!?  
Tired of spam? Yahoo! Mail has the best spam protection around

> **[Yahoo Mail - Organized Email](https://mail.yahoo.com/)**
>
> It's time to get stuff done with Yahoo Mail. Just add your Gmail, Outlook, AOL or Yahoo Mail to get going. We automatically organize all the things life throws at you, like receipts and attachments, so you can find what you need fast. Plus, we've got...
