Compiling with g++

Asked

Viewed 1,145 times

2

I am compiling an example code provided on the GLFW bookstore website as follows: g++ main.cpp -o main.exe glfw3dll.a <- this way it is possible to compile, but what if I want to change the files from place?

My intention is to maintain a structure

+include
--GLFW/glfw3.h
+libs
--glfw3dll.a

But I can’t link the library with the command -L/libs/ -lglfw3dll

g++ main.cpp -o main.exe -L/libs/ -lglfw3dll

ld.exe: cannot find -lglfw3dll
collect.exe: error: ld returned 1 exit status

Since the compiler can’t find the bookstore if I am informing in the command where it is?

  • The bookstore you specified is a Static Linked library, isn’t it? As far as I know, this dynamic linking process only works with dynamic link libraries (ending with .so). Recompile your glfw3.h as a dynamic link library and try to do this.

1 answer

2


Unable to link using the flag -l because the name of the library should be libglfw3dll.a.

Because as I mentioned in one of my old posts it is mandatory to have lib in the name.

  • Man, I don’t know what I look like, I noticed that I could link to the other libraries that had lib in the prefix, but I was so sleepy I didn’t even try to change the name of the one I needed to link to. Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.