LNK2019 c和c++混合编程

解决方法: 对c编写的部分,添加

#ifdef __cplusplus
extern "C" {
#endif

 

#ifdef __cplusplus
}
#endif

到其头文件中。

 

注意构造函数和析构函数的实现

CHtMotion_extern(void){  };

 

当前项目源文件路径里没有相应的文件。

include其他工程的头文件后,也要include相应的函数实现的文件。不然只有声明,没有实现,就链接不了。

.c只include一次,不然会有重命名问题。

 

LNK2001  google test 框架 TEST_F用法

class CHtMotion_test : public testing::Test //不需要继承CHtMotion_extern类
{
protected:
CHtMotion_extern* test;
virtual void SetUp(){
this->test = new CHtMotion_extern;
}

virtual void TearDown(){
delete this->test;
}
};

 

 posted on 2017-10-19 15:23  妍血  阅读(182)  评论(0)    收藏  举报