So I am trying to use the setpixel function but I need a library Gdi32lib.h and a DLL Gdi32.dll.
first off, I am very new to c++ so don't judge me on these next few questions.
1. what is a DLL.
2. how do I get that DLL.
3. how do I get that library.
if I was supposed to download it when I got Visual studio, I guess I didn't, in which case where do I go to get it if I boched the download in the first place.
also it gives me this error
Severity Code Description Project File Line Suppression State
Error (active) E0337 linkage specification is incompatible with previous "SetPixel" (declared at line 4575 of "C:\Program Files\Windows Kits\10\Include\10.0.17763.0\um\wingdi.h") testNo.2
Gdi32.dll already exists on your system. (It is a core Windows component.)
You may not have gdi32.lib. (This is part of your compiler’s development environment.) If you do not, or if you are not sure:
(1)
Visual studio does not automatically come with everything necessary to compile and execute C++ and Win32 code.
Restart your VS installer and make sure that you have the “Desktop Development with C++” and “Windows API/SDK” (or whatever it is called) selected, then continue. This will update your environment.
(2)
Before you compile, go to your project options and add “Gdi32” in the list of libraries to link with your executable. VS will not do this automatically for you.
If you wish to be more general, somewhere near the top of your main source file (.cpp), add:
#pragma comment( lib, "gdi32" )
This tells MSVC (and GCC as well) to link with the Gdi32 library.
first off, im not sure if I did what u said. I opened VS installer and ended up updating it, and then updating visual studio community 2017(which is the thing I use to program) and just incase that's not what you told me to do, how do I restart the installer.
You need a selected and active DC to use SetPixel().
I suggest you find yourself a tutorial on Win32 GDI programming (not GDI+, as that is something different).
A very good place to start is (theForger's Win32 API Tutorial|http://www.winprog.org/tutorial/), which will get you to the point of having a window and being able to create a bitmap and access the GDI device context.
A DC is a device context. This is explained in the link.
If you want to learn to push pixels in a Win32 application, you must learn Win32. I have given you the correct tutorial.
If you are studying C++ in school or something, I suggest you be careful not to get too distracted by non-course material. Stick with what is necessary to understand the course objectives, and save doing cool extra stuff for personal projects on your own time.