I'm finding a way to use GDI+ library with g++ compiler, I have read some guildlines on the web and still meet with problem...
Here is my code:
#include "gdiplus.h"
using namespace Gdiplus;
// Skip Lines
GdiplusStartup(&lpGdiplusToken, &gdiplusStartupInput, &gdiplusStartupOutput);
// Skip Lines
And I have already used the compiler switch as below:
g++ -Wall -mwindows -lgdiplus -I"C:\MinGW\include" -I"C:\MinGW\include\gdiplus" -L"C:\MinGW\lib" -g3 -finput-charset=GBK "$(FilePath)" -o "$(FileDir)\$(FileNameNoExt).exe"
Still I got such errors:
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccjX3mCb.o: In function `WinMain@16': D:/Projects/cyau/cyau_pre4_20120226/cyau_main.cpp:65: undefined reference to `GdiplusStartup@12' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccjX3mCb.o: In function `Z15ExitApplicationP6HWND__jjl': D:/Projects/cyau/cyau_pre4_20120226/cyau_main.cpp:128: undefined reference to `GdiplusShutdown@4'
So what's wrong with it? Is there anything more I need?
Thanks for help...
I had similar messages as you and after some research I've come to the following: place -lgdiplus
after *.cpp
files on the command line. Example:
g++ -mwindows program.cpp -lgdiplus
That command compiled my GDI+ program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With