C++ GUI Tutorial: undefined reference to TextOut

匿名 (未验证) 提交于 2019-12-03 10:10:24

问题:

So after a bit of searching for Win32 GUI tutorials (I decided a tutorial on making GUIs might make me more active in making C++ applications and therefore stronger at programming in C++ in general,) I came across a rohitab tutorial. There are two parts that I have been able to find. Part 1 worked fine, and I'm now working on Part 2, however, I'm getting this error in Code::Blocks:

C:\Users\John\Documents\Windows GUIs\first_gui.cpp||In function 'C:\Users\John\Documents\Windows GUIs\first_gui.o:first_gui.cpp:(.text+0x281)||undefined reference to '_TextOutA@20'|

My code can be found here.

I would greatly appreciate any help.

回答1:

Did you link your app against GDI32.LIB?



回答2:

Looks like a linker error, are you linking to gdi32.lib?



回答3:

You should download a WINDOWS SDK package, this include all libraries that you will need to create programs with GDI (including gdi32); Then in codeblocks/compiler/linkersettings choose folder where SDK's lib files are stored. That's is it!!.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!