0

when you use windows.h. The program compiles normally but there some functions that require a .lib file and .dll file. so lets i want to use CreateSolidBrush, its requires Gdi32.lib and Gdi32.dll. so to include or compile with them or whatever it is. what i must type in the command line?

or its possible to include the .lib file inside the source code?

note : i know the dll files not includable. to use them just put them in the same place with exe. but i am asking for .lib files!

g++ main.cpp ...

Star Dev
  • 59
  • 4
  • It is technically possible to include even the dll files in your exe, but that requires unorthodox hacks. To link with the lib files, check out this: https://stackoverflow.com/questions/38584344/linking-a-lib-file-on-windows-7 – Sven Nilsson Sep 25 '22 at 16:59
  • https://www.mingw-w64.org/ – Hans Passant Sep 25 '22 at 17:07
  • The windows dlls are already in the system folder, there is no need to put them in the program folder. – CGi03 Sep 25 '22 at 17:11
  • 1
    Under minGW you just have to put the -lgdi32 option to link the gdi32.dll import library – CGi03 Sep 25 '22 at 17:14
  • I’m voting to close this question because Easily answered with a simple search – SoronelHaetir Sep 25 '22 at 17:15
  • Compile with Visual Studio so you can use `#pragma comment(lib,"mylib")` that doesn't exist with GCC https://stackoverflow.com/questions/1685206/pragma-commentlib-xxx-lib-equivalent-under-linux – Simon Mourier Sep 25 '22 at 17:28
  • Specifying the libs in the source code always feels wrong to me. Should be in the make file or whatever build tool you use. – David Heffernan Sep 25 '22 at 17:39

0 Answers0