Whirvis
Whirvis

Reputation: 312

MinGW linking paths

I am currently trying to link a library using MinGW with the following command:

g++ main.cpp -l"C:\Users\Whirvis\Desktop\glfw3"

This command does not work, however the following does:

g++ main.cpp -lglfw3

Because of this, I think the compiler is probably searching for glfw3.dll in C:\Users\Whirvis\Desktop\C:\Users\Whirvis\Desktop which obviously doesn't exist. Is there a way to tell G++ to search for a library using an absolute path rather than a relative one?

Note: The main.cpp file contains no code, I am simply just trying to link a DLL before I actually write anything.

Upvotes: 1

Views: 882

Answers (1)

Swift - Friday Pie
Swift - Friday Pie

Reputation: 14589

For gcc family -l is option to specify library name, it searches names in system folders (defined in environment), you can add folders to lookup list by the -L option, just like VTT commented:

-L<library_folder_path>

Upvotes: 1

Related Questions