I have a solution created using visual studio 2008 named, " Solution ", and i have two projects in that solution, project " A " and project " B ". when i do a thing like below it shows fatal errors in the bottom. I have given in project A->properties->Additional include Directries as ../B
project B
Bh
#include <iostream>
using namespace std;
class B
{
public:
B();
~B();
};
B.cpp
#include "B.h"
B::B()
{
}
B::~B()
{
}
project A
Ah
#include <iostream>
using namespace std;
class A
{
public:
A();
~A();
};
A.cpp
#include "A.h"
#include "B.h"
A::A()
{
B b;
}
A::~A()
{
}
Main.cpp in project A
#include "B.h"
int main()
{
B b;
system("pause");
}
when i run it says
Error 3 fatal error LNK1120: 2 unresolved externals H:\\Sol\\Debug\\A.exe
Error 2 error LNK2001: unresolved external symbol "public: __thiscall B::B(void)" (??0B@@QAE@XZ) A.obj
Error 1 error LNK2001: unresolved external symbol "public: __thiscall B::~B(void)" (??1B@@QAE@XZ) A.obj
It doesn't look like you are exporting class B out of project B. So project A sees the declaration of class B but can't find its implementation. What does project B build?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.