   GDI+ compiling issues
  I'm using VS 2005 Pro & the Platform SDK.  I created an empty Win32 project.I used this code taken from the MSDN but it will not compile. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/usingGDIPlus/gettingstarted/drawingaline.aspI get the errors:------ Build started: Project: GDItools, Configuration: Release Win32 ------Compiling...main.cpp.\main.cpp(62) : warning C4244: 'return' : conversion from 'WPARAM' to 'int', possible loss of dataLinking...main.obj : error LNK2001: unresolved external symbol _GdiplusShutdown@4main.obj : error LNK2001: unresolved external symbol _GdipDeletePen@4main.obj : error LNK2001: unresolved external symbol _GdipDeleteGraphics@4main.obj : error LNK2001: unresolved external symbol _GdipCreateFromHDC@8main.obj : error LNK2001: unresolved external symbol _GdipDrawLineI@24main.obj : error LNK2001: unresolved external symbol _GdipCreatePen1@16main.obj : error LNK2001: unresolved external symbol _GdiplusStartup@12C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\GDIgame\Release\GDItools.exe : fatal error LNK1120: 7 unresolved externalsBuild log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\GDIgame\GDItools\Release\BuildLog.htm"GDItools - 8 error(s), 1 warning(s)========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========   
  You need to add gdiplus.lib to the list of additional libraries to link to.;  gdiplus.lib is in the platform SDK.  I did include the directory C:\Program Files\Microsoft Platform SDK\Libin my VS C++ directory settings.  Still not working.   ;  You have to go into you project properties and explicitly add the library to the "Additional Dependencies" on the Linker->Input property page.   ;  Thank You Mr. Hunt   ;  You're very welcome!;  Now, I just realized that I cannot create an executable from the above MSDN source code.The error I get is  below and it won't compile into an executable even though it does build.  Also, it only builds in "Release" mode..\GDIplay.cpp(62) : warning C4244: 'return' : conversion from 'WPARAM' to 'int', possible loss of dataHere is the source code directly from the above MSDN GDI+ link.#define UNICODE#include <windows.h>#include <gdiplus.h>using namespace Gdiplus;VOID OnPaint(HDC hdc){   Graphics graphics(hdc);   Pen pen(Color(255, 0, 0, 255));   graphics.DrawLine(&pen, 0, 0, 200, 100);}LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, PSTR, INT iCmdShow){   HWND hWnd;   MSG  msg;   WNDCLASS  wndClass;   GdiplusStartupInput gdiplusStartupInput;   ULONG_PTR gdiplusToken; // Initialize GDI+.   GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); wndClass.style= CS_HREDRAW | CS_VREDRAW;   wndClass.lpfnWndProc    = WndProc;   wndClass.cbClsExtra= 0;   wndClass.cbWndExtra= 0;   wndClass.hInstance = hInstance;   wndClass.hIcon= LoadIcon(NULL, IDI_APPLICATION);   wndClass.hCursor   = LoadCursor(NULL, IDC_ARROW);   wndClass.hbrBackground  = (HBRUSH)GetStockObject(WHITE_BRUSH);   wndClass.lpszMenuName   = NULL;   wndClass.lpszClassName  = TEXT("GettingStarted"); RegisterClass(&wndClass); hWnd = CreateWindow( TEXT("GettingStarted"),   // window class name TEXT("Getting Started"),  // window caption WS_OVERLAPPEDWINDOW, // window style CW_USEDEFAULT,  // initial x position CW_USEDEFAULT,  // initial y position CW_USEDEFAULT,  // initial x size CW_USEDEFAULT,  // initial y size NULL, // parent window handle NULL, // window menu handle hInstance, // program instance handle NULL);// creation parametersShowWindow(hWnd, iCmdShow);   UpdateWindow(hWnd); while(GetMessage(&msg, NULL, 0, 0))   { TranslateMessage(&msg); DispatchMessage(&msg);   } GdiplusShutdown(gdiplusToken);   return msg.wParam;}  // WinMainLRESULT CALLBACK WndProc(HWND hWnd, UINT message,    WPARAM wParam, LPARAM lParam){   HDChdc;   PAINTSTRUCT  ps; switch(message)   {   case WM_PAINT: hdc = BeginPaint(hWnd, &ps); OnPaint(hdc); EndPaint(hWnd, &ps); return 0;   case WM_DESTROY: PostQuitMessage(0); return 0;   default: return DefWindowProc(hWnd, message, wParam, lParam);   }} // WndProc;  That is not an error. It is only a warning and will not prevent an executable from being created. Either there is another error that you didn't see, or there is a problem with your installation.The reason for the warning is that the code is returning msg.wParam, which is defined as an unsigned integer. Just change the line to:return (INT)msg.wParam;to get rid of the warning.;Quote:Original post by Dave HuntYou have to go into you project properties and explicitly add the library to the "Additional Dependencies" on the Linker->Input property page.Not to hijack the topic, but would that be an alternative to using #pragma comment? - for example: #pragma comment (lib, "winmm.lib")   ;Quote:Original post by vinbQuote:Original post by Dave HuntYou have to go into you project properties and explicitly add the library to the "Additional Dependencies" on the Linker->Input property page.Not to hijack the topic, but would that be an alternative to using #pragma comment? - for example: #pragma comment (lib, "winmm.lib")Yes. It serves the same purpose. The advantage of the pragma is that you don't have to remember to add it to your project settings whenever you use that code in another project. The disadvantage is that the pragma is non-standard and not supported by every compiler.