'Using Cygwin to generate and link DLL to another project

C++ newbie here, I have this game engine I am making and I would like to export it into .dll and use it in a sandbox project. It depends on GLFW, spdlog and Vulkan. I am using g++ on Windows with Cygwin.

Here is a simple version of my project:

Sandbox
   |----Sandbox.cpp
Engine
   |----Engine.h
   |----vendor
           |----glfw
           |----spdlog

So Sandbox.cpp includes <Engine.h>, Engine.h includes <GLFW/glfw3.h>

Here are my commands:

  1. First compile from Engine:

    g++ -std=gnu++11 -I someIncludeDir -c someCPP.cpp -o objectFiles.o

  2. Then build dll:

    g++ -shared -o objectfiles.o -L./path/to/GLFW/DLL -L"C:\Windows\System32" -lglfw3 -lopengl32 -lgdi32 -lvulkan-1 cygxxx.dll -Wl,--out-implib,libxxx.dll.a

  3. This will give me a cygxxx.dll and libxxx.dll.a.

  4. I moved these 2 files into Sandbox project.

  5. Compile the Sandbox project:

    g++ -std=gnu++11 -I../Engine/Engine.h someCPP.cpp -c objectfiles.o

And this is where I got the error saying <GLFW/glfw3.h> not found.

My confusion is, I don't want to include GLFW or Vulkan in my Sandbox project, nor do I want to include them in my compiler flag. Is this even possible?

Please help a C++ noob.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source