在Window store应用程序上链接错误LNK2019 [英] Link error LNK2019 on Window store Application
本文介绍了在Window store应用程序上链接错误LNK2019的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用C ++ Window商店应用程序,我需要一个dll。
I am working on C++ Window store application where I need a dll.
#pragma once
using namespace Windows::Foundation;
namespace MyText
{
public ref class Class1 sealed
{
public:
Class1();
int Add(int x, int y);
};
}
如果我删除添加功能,则没有错误。我无法理解为什么?
If I remove Add function then there is NO error. I am unable to understand why?
推荐答案
如果你只在标题中写它是声明。如果你在cpp文件中实现它,不仅你的链接器会很高兴; - )
if you only write it in the header it is the declaration. If you implement it in the cpp file not only your linker will be happy ;-)
改变来自
Change from
引用:
int Add(int x,int y);
int Add(int x, int y);
to
to
int Add(int x, int y){return (x+y);}
编译器会祝福你。
这篇关于在Window store应用程序上链接错误LNK2019的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文