I have the stdafx.h
file and a source (test.cpp
) file in the default directory (C:\Users\Roland\Desktop\projects\test\test
) together with a header (header.h
) and a source (source.cpp
) file in an other directory (C:\Users\Roland\Desktop\projects\add
) than the default one. The content of these files is the following:
stdafx.h: empty
test.cpp:
#include "stdafx.h"
#include <header.h>
int main()
{
int a = 2;
int b = 3;
swap(a, b);
return 0;
}
header.h:
#ifndef _HEADER_H_
#define _HEADER_H_
void swap(int &a, int &b);
#endif
source.cpp:
void swap(int &a, int &b)
{
int c;
c = a;
a = b;
b = c;
}
I added the following path to the "Additional Include Directory" record: ../../add
. When trying to build the solution, I received an error:
error LNK2001: unresolved external symbol "void __cdecl swap(int &,int &)" (?swap@@YAXAAH0@Z)
Could you please help me what would be the problem?
update:
I need a solution to making all the source files of the add
directory available for my project.