biskit
biskit

Reputation: 11

Error when compiling olcPixelGameEngine with g++

I'm trying to use OneLoneCoder's olcPixelGameEngine, but when I try to compile my file (g++ -o YourProgName YourSource.cpp -lX11 -lGL -lpthread -lpng -lstdc++fs -std=c++17), I get the error:

fatal error: dwmapi.h: No such file or directory

I use g++ 9.2 with MinGW. Where do I find dwmapi.h?

Upvotes: 1

Views: 1180

Answers (2)

Moros Smith
Moros Smith

Reputation: 145

2 problems I'm seeing immediately

First, you're not using the proper build command for MinGW, you're using the Linux GCC build command, which is requiring libraries that don't exist in MinGW.

Instead try something like this:

g++ -o olcExampleProgram.exe olcExampleProgram.cpp -luser32 -lgdi32 -lopengl32 -lgdiplus -lShlwapi -ldwmapi -lstdc++fs -static -std=c++17

Second, you're likely using a bad version of MinGW.. Long story short, not all MinGW are created equal and currently, the best version (and the one that has been tested to compile PGE applications) is the version provided by MSYS2.

If you want you can check the PixelGameEngine WIKI page on the subject.

https://github.com/OneLoneCoder/olcPixelGameEngine/wiki/Compiling-on-Windows-with-Other-Compilers

Upvotes: 2

GorbitGames
GorbitGames

Reputation: 110

That's the Linux build command, look at this instead: https://community.onelonecoder.com/2020/05/08/lets-make-an-olcpixelgameengine-application-using-mingw/ Also, next time you probably get quicker help on the discord server

Upvotes: 0

Related Questions