Search code examples
c++linkerstatic-linking

Linking glfw and assimp for a "standalone" project


I have a project following this tutorial. It works fine on my pc, but not on others since the libraries are not installed there. I have assimp, glfw, glm and stb installed through msys, so they are not directly included in the project. How would i need to link the libraries so that the application runs on other mashines? Ideally i would like to use static links (not sure how tho), but including the libraries with the appilcation would be fine too.

Makefile:

CC = g++

SRC = $(wildcard src/*.cpp) $(wildcard src/**/*.cpp) $(wildcard lib/**/**/*.c)

LIBS = -lassimp.dll -lglfw3.dll

CFLAGS = -Wall -Wextra -g3 -O2 -Ilib -Ilib/glad/include -Isrc

OUT = bin/main

all:
    $(CC) $(SRC) $(CFLAGS) $(LIBS) -o $(OUT)

Solution

  • Static linking is now working! The commands for linking now look like this:

     -l:libglfw3.a -opengl32 -lgdi32 -l:libassimp.a -lminizip -lz
    

    I just had some libraries missing that glfw and assimp depended on.