I have a strange error that has bothered me all day. I have a library function that I have compiled. I statically link the library to test it in a separate console application and everything builds and works ok. It is just a simple sqrt function called sqrtval at the moment. However, when I include this library in a larger graphical project then I get linker errors. I have set the Additional library directories and Additional dependency settings identically in both the console app (that works) and the graphical main app (that does not work). The error is as follows.
1
Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
1>Copyright (C) Microsoft Corporation.
All rights reserved. 1>Linking…
1>MainAppWindow.obj : error LNK2019:
unresolved external symbol “double
__cdecl sqrtval(double)” (?sqrtval@@YANN@Z) referenced in
function “public: virtual void
__thiscall MainComponent::sliderValueChanged(class
juce::Slider *)”
(?sliderValueChanged@MainComponent@@UAEXPAVSlider@juce@@@Z)
1>….\bin\Debug\tutorial.exe : fatal
error LNK1120: 1 unresolved externals
If your library is written in plain C, you have to declare
sqrtvalas: