Rubberband linker failed on Windows

Hi, i was playing around with the rubberband library, it’s all good till i build the project and i got linker failed error. I also tried to build a rubberband dynamic library to include by following the ReadMe. However i could not proceed further since the instruction was kind of insufficient to me. Is there a shorter way to include the library? If not, how to build the dynamic library. Thanks in advance :heart:

Hi there again :slight_smile:
I don’t think anyone is able to properly help you without any further information what you tried and what the error is. Nonetheless, in my experiences these errors are hard to tackle down but only require a very minuscular change. Linker errors almost always come from a missing file (at least thats how it always went for me).

Getting around those bugs is (for me) especially difficult, because it was very hard at the beginning to understand what the IDE is doing for me somehow with black magic and where I had to come in and do it myself. For that reason, it is very important to have a basic understanding of what happens when you compile your c++ code into an executable. Here is a ruff overview:

  1. Every *.cpp file is compiled into an object file (.o) containing only the compiled code for that specific cpp file and of course everything it included. It also throws away declarations (basically the contents of the header file) as it really only contains the compiled down methods and with their name and what they are doing.
  2. Second stage linking combines all object files into one executable. Now all the method calls are pointed to the correct position (e.g. if you only included a header file for some method to be sued – now this is resolved and all method calls inside cpp are pointed to the approbate places). This is were you get vague errors of “missing symbol” (method implementation missing) or “duplicate symbols” (method implemented twice).

Now were you are struggling is getting a library involved. In theory, you don’t have the source code, just the header files but your code is of course still supposed to no what to execute when a method from a library is called. There are two ways to resolve this: static linking and dynamic linking.
Static linking is when you essentially include the entire library into your executable. It’s as simple as that, no further information needed. It’s basically treated like an own big object file resulting in the same kind of symbolic errors like above.
Dynamic linking is: you tell your executable were to look on the users computer for the libraries, load them on startup, link everything up and execute. That massively decreases the size of the executable. Imainging linking against operating system libraries statically. Your executable would become the size of 10Gig upwards even though the code is already on the users computer.
But it requires the user to install libraries/dependencies. This is why you probably want to link rubber band statically.

Linker errors with static and dynamic libraries may result on you not telling the compiler were to look. So make sure you didn’t make any typing mistakes or forgot a sub directory or something like $PROJECT not pointing to were you think it is. The linker errors shows you all directories it looked in. Some are probably built in by the IDE (like /usr/lib or something like that).

I hope I was helpful in some kind.

Thanks for your reply. I tried following your instruction to link a static one, but it kept saying library not found:

I tried change the External libraries to link to the absolute path of the library but it said syntax error

There should be a full built time log available somewhere in the IDE where the linker command tells you where it looked. Then you can check weither you Directory is that list or if it the path to it is busted somehow.

@Rincewind I was able to include the static library but when building the project, the header and the static lib seems not to be linked, thus, i got this error: