Search code examples
clangllvmllvm-clanglld

Clang Windows LD Set Library Path Not Work?


Compiling on windows with 6.0.0 or 6.0.1

ld.lld can't find the library in specified path.

This does not work:

ld.lld Source.o -o Executable.exe -L"C:/Users/Username/Documents/" libcode.a

But this does:

ld.lld Source.o -o Executable.exe C:/Users/Username/Documents/libcode.a

Am I doing something wrong here? It works with gnu ld just fine.


Solution

  • -l flag is required, omitting the "lib" prefix and extension.

    ld.lld Source.o -o Executable.exe -L"C:/Users/Username/Documents/" -lcode