开发者

when I'm trying to use separate *.h and *.cpp I'm geting error LINK2019

I've code like

A.h
Class A{
  public:
    void FuncA();
}

A.cpp
#include "A.h"
void A::FuncA() {}

B.h
#include "A.h"

Class B{
  public:
    void FuncB();
}

B.cpp
#include "B.h"
void B::FuncB(){
  A *a = new A();
  a->FuncA();
}

When I'm开发者_如何学JAVA trying to build this project I'm geting "error LNK2019: unresolved external symbol "public: void __thiscall A::FuncA()" (?FuncA@A@@QAEXH@Z) referenced in function "public: void __thiscall B::FuncB(void)" (?FuncB@B@@MAEXXZ) B.obj project"

It makes A.obj and B.obj.


The code looks ok. Make sure to rebuild everything first and that A.obj is really sent to the linker.


Response to comment

Check the build log in VS2008. See picture below:

when I'm trying to use separate *.h and *.cpp I'm geting error LINK2019

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜