I'm trying to figure out how to create libraries in my projects and work with multiple files in general.
However, ld reports it "cannot find -lhello" (where libhello is my custom library). It compile fine when I use -l:libhello.so, though.
I then ran ld with the --verbose option and here's what I got:
[...]
attempt to open lib/libhello.dll.a failed
attempt to open lib/hello.dll.a failed
attempt to open lib/libhello.a failed
attempt to open lib/hello.lib failed
attempt to open lib/libhello.dll failed
attempt to open lib/hello.dll failed
attempt to open lib\libhello.a failed
[...]
The list goes on to a bunch of other directories and filenames, but turns out not a single one of them is either "hello.so" or "libhello.so". I have no clue why, but it seems like ld isn't looking for .so files when compiling. What do I do here?
On Windows, shared libraries have a
.dll
suffix, not.so
. If you have a Makefile that is generating shared libraries for Windows, they should have a.dll
extension.Also on Windows, import libraries are used, which is why you see both