I'm trying to link an outside library in my C++ VS2013 project. Upon compiling the project I get the error:
Error 1 error LNK2019: unresolved external symbol "void __cdecl bar(void)" (?bar@@YAXXZ) referenced in function _main D:\Projects\IncludeOutsideLib\main.obj IncludeOutsideLib
I have setup Configuration Properties->C/C++->Additional Include Directories to point to the outside library folder`$(PROJECTDIR)/../Foo/`. Is there anything else I need to do?
The project/directory structure is very simple
Projects:
Foo:
foo.h
foo.cpp
IncludeOutsideLib:
// contains C++ VS2013 project
main.cpp
foo.h:
#ifndef FOO_H
#define FOO_H
#include <cstdlib>
void bar();
#endif // FOO_H
foo.cpp:
#include "foo.h"
void bar()
{
printf("bar\n");
}
main.cpp:
#include <iostream>
#include <cstdlib>
#include "foo.h"
int main(int argc, char** argv)
{
bar();
system("pause");
return 0;
}