Public Group

# dev, win32 api, and graphic primitives

This topic is 4986 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

i'm trying to draw graphic primitves in dev, using the win32 api. i'm #including <windows.h> and the library where these functions are supposed to be has even been specifically including using #pragma comment, even though i'm 99% certain that libgdi32 is being included by default. anyway, the compiler doesn't recognize the functions like TextOut() or CreatePen(), the only funtion like that i've gotten to work is DrawText() and i don't think that it's in libgdi32. ne1 know what i could do? the compiler errors are kind of weird because they don't call the function by the same exact name i'm using to call them.... which may be the problem... here's a snippet and the corresponding error: ... TextOut(hDC, 10, 10, TEXT("Hello"), 5); ... [Linker error] undefined reference to TextOutA@20' and the compile log: Compiler: Default compiler Building Makefile: "C:\Dev-Cpp\projects\cropCricles\Makefile.win" Executing make... make.exe -f "C:\Dev-Cpp\projects\cropCricles\Makefile.win" all g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include" -I"C:/dxsdk/SDK (C++)/Include" windres.exe -i cropCircles_private.rc -I rc -o cropCircles_private.res -O coff g++.exe GameEngine.o main.o cropCircles_private.res -o "cropCircles.exe" -L"C:/Dev-Cpp/lib" -L"C:/dxsdk/Lib" main.o(.text+0x140):main.cpp: undefined reference to TextOutA@20' make.exe: *** [cropCircles.exe] Error 1 Execution terminated

##### Share on other sites
Have you ever tried using the default windows api application? In Dev, its like File - New - Windows App. You could check the code in there to see what they include and then maybe add your functions in on top of that code. You could just cut and paste it over. This might not solve your problem, but it couldn't hurt to try. I don't program using the windows api that much.

##### Share on other sites
TextOut "mutating" to TextOutA is a simple macro trick. The windows headers are full of this. This enables you to enable unicode by simply setting a define, without modifying any code. TextOut is a define that either maps to TextOutA or TextOutW.

About the pragma comment, i had the impression that was a MSVC specific pragma and not widely supported? Did you try to include the library the "correct" way?

##### Share on other sites
no, that was the way that was suggested to me.... any help would be appreciated

and i don't want to use dev's windows template, i'd like to use my own i made.... but maybe i should just load it then copy and paste my own code over what's already in there like u suggested

##### Share on other sites
never mind, i figured it out.... dev had it defaulted to a win32 console, not a gui... everything's all better

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 14
• 46
• 22
• 27
• ### Forum Statistics

• Total Topics
634047
• Total Posts
3015232
×