0

I am trying to set VS (2015) project on Windows 10 to use external library however whatever I do I end up with LNK2019 errors.
If that helps library I am interested in is CWO++; I downloaded all the versions and tried them all, none worked. There are installation instructions available on library site, however following them yeilded no success.

What I did:

[WINDOWS]

  • I organized each of library version root directory to consist of 2 sub-directories:
    • src - containing all .h, .cpp files
    • bin - containing all .lib, .dll files
  • Set up CWO_PATH envirnoment variable pointing to version I was trying out at the moment, for instance CWO_PATH = D:\Coding\cwo\0.20
  • Added both directories - that is src and bin - to the PATH for instance: D:\Coding\cwo\0.20\bin and D:\Coding\cwo\0.20\src (as instructed on the site).
  • Also checked just in case whether .lib files are indeed 64-bit as described here

[VISUAL STUDIO]

  • Created empty c++ project
  • Edited properties of x64 configuration:
  • C/C++/General tab, in Additional Include Directories added $(CWO_PATH)/src
  • Linker/General tab, in Additional Library Directories added $(CWO_PATH)/bin
  • Linker/Input tab, in Additional Dependencies added cwo.lib; in the beginning

  • Added main.cpp with following code


#include <cwo.h>

int main()
{
    CWO c;
}

After building the project I get 3 errors: enter image description here

Im assuming that the library is not linked properly. Can you please tell me what is wrong with this configuration?

EDIT Linker settings enter image description here enter image description here Windows lib directory enter image description here

michelson
  • 686
  • 9
  • 22
  • can you take a screen shot of your linker settings just to double check, maybe there is a typo. Can you also confirm with windows explorer that the files are located where you expect them to be. – agent_bean Nov 07 '18 at 12:57
  • While you might have set the x64 settings, that is not what you actually built. I can tell from `_main`, that leading underscore only appears in a x86 build. Get ahead with Build > Configuration Manager. And when you make such setting changes, ensure that the two comboboxes at the top of the dialog are set to "All..." – Hans Passant Nov 07 '18 at 12:58
  • @rafaelgonzalez screenshots uploaded – michelson Nov 07 '18 at 14:22
  • @HansPassant I can try that, thanks – michelson Nov 07 '18 at 14:23
  • From the screenshot, it is visible, that you are switching between configurations (*Active(x64)* and *Active(Win 32)*). Make sure, that you configured the project in all combinations of Configuration and Platform. – Zereges Nov 07 '18 at 14:25
  • @Zereges unifying configurations yeilded same results - LNK2019 - does not matter if I run x64 or x86 build. – michelson Nov 07 '18 at 17:23
  • @michelson I tried the library at home, and i get the same results as you. – agent_bean Nov 07 '18 at 20:20
  • @rafaelgonzalez thanks a lot! I think it means that something is wrong with .lib itself. I wanted to avoid it but I guess I have to compile it myself... – michelson Nov 07 '18 at 21:29
  • @michelson I did the same and tried the library myself and latest version even contains a typo in source, which made it non compilable, which literally means, that the `.lib` file doesn't correspond to source files. – Zereges Nov 07 '18 at 22:36
  • @Zereges yes, I had some problems with source as well... I will try each versions' source - maybe one of them is reliable. Else I will have to apply 'fixes' on my own and try to compile it somehow. Thanks for help! – michelson Nov 08 '18 at 08:27

0 Answers0