dacap / pocketcpp

Compile C++11 / C++14 / C++17 / C++20 snippets with Notepad++ and MinGW/gcc 9.2.0
83 stars 17 forks source link

gdi+ and windows errors #11

Open johnshadow23 opened 9 years ago

johnshadow23 commented 9 years ago

When I was using gdiplus and just gdi a few errors came up on me :? I have no idea how to fix them. EX: C:\Users\JOHNS_~1\AppData\Local\Temp\cckUtaZ9.o:graphics_Test.cpp:(.text+0xa5): undefined reference to __imp_CreateCompatibleDC' C:\Users\JOHNS_~1\AppData\Local\Temp\cckUtaZ9.o:graphics_Test.cpp:(.text+0xc2): undefined reference toimpCreateCompatibleBitmap' C:\Users\JOHNS~1\AppData\Local\Temp\cckUtaZ9.o:graphics_Test.cpp:(.text+0xda): undefined reference to __imp_SelectObject' C:\Users\JOHNS_~1\AppData\Local\Temp\cckUtaZ9.o:graphics_Test.cpp:(.text+0x108): undefined reference toimpGetStockObject' C:\Users\JOHNS~1\AppData\Local\Temp\cckUtaZ9.o:graphics_Test.cpp:(.text+0x136): undefined reference to __imp_SelectObject' C:\Users\JOHNS_~1\AppData\Local\Temp\cckUtaZ9.o:graphics_Test.cpp:(.text+0x146): undefined reference toimpDeleteDC' C:\Users\JOHNS~1\AppData\Local\Temp\cckUtaZ9.o:graphics_Test.cpp:(.text+0x1a9): undefined reference to __imp_CreateCompatibleDC' C:\Users\JOHNS_~1\AppData\Local\Temp\cckUtaZ9.o:graphics_Test.cpp:(.text+0x1c1): undefined reference toimpSelectObject' C:\Users\JOHNS~1\AppData\Local\Temp\cckUtaZ9.o:graphics_Test.cpp:(.text+0x20c): undefined reference to __imp_BitBlt' C:\Users\JOHNS_~1\AppData\Local\Temp\cckUtaZ9.o:graphics_Test.cpp:(.text+0x220): undefined reference to__impSelectObject' C:\Users\JOHNS~1\AppData\Local\Temp\cckUtaZ9.o:graphics_Test.cpp:(.text+0x230): undefined reference to `__imp_DeleteDC' I would Like to know If these can be fixed, or if I have to include something to fix them.

dacap commented 9 years ago

Hi @johnshadow23, are you using the compiler from the command line? or are you compiling from the Notepad++ editor?

If you are compiling from Notepad++, you should take care about the command line options, they are specified in the pocketcpp\npp\plugins\config\npes_saved.txt:

::Compile C++ File
NPP_SAVE
g++ -o "$(CURRENT_DIRECTORY)\$(NAME_PART)" "$(FULL_CURRENT_PATH)" -static

I think you need User32 library (-luser32 link parameter), anyway I don't know if you can use gdi+ from g++ (mingw). Do you have an .a library for gdi+?

johnshadow23 commented 9 years ago

I'm using the one from notepad++ (Sorry I have been doing a lot of things lately and have not been able to respond.) no I do not have a .a file for gdi? How would I get one?