#include "core.h" #define WIN32_LEAN_AND_MEAN #include <iostream> #include <winsock2.h> #include <string> #include <Windows.h> #include <gdiplus.h> #pragma comment(lib, "Ws2_32.lib") #pragma comment (lib,"Gdiplus.lib") using namespace std; using namespace Gdiplus; ... void Create(int n, HDC ConsoleDc){ GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; HDC hdc=ConsoleDc; // Initialize GDI+. GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); Gdiplus::Graphics graphics(hdc); Image image(L"img.jpg"); graphics.DrawImage(&image, 60, 10); }; 

alt text Help!

  • Hm Some kind of bug in hederah. Try moving #include <gdiplus.h> higher. And also: drag #define WIN32_LEAN_AND_MEAN to stdafx.h (by the way, where is your place?) - VladD
  • @VlaD, I recently started learning a language, so I don’t have time to get to everything. Explain why this stdafx.h is needed? In nete it says "for precompiled headers". What is it? UPD moving gdiplus didn't help - ololo
  • @ololo: This is a long story. In principle, they are not needed, but they will come in handy to speed up the compilation. Such a specific hack from compiler developers. And if you delete gdiplus, on which line will it fly out? - VladD
  • @VlaD, if you remove Gdplus then again errors: 24 pcs. Here is one: 'to_string': is not a member of 'std' - ololo

1 answer 1

It turns out you need to connect in this order:

 #include "core.h" #include <winsock2.h> #include <ws2tcpip.h> #include <objidl.h> #include <gdiplus.h> #include <stdio.h>