【问题标题】:Windows 8 metro app identifier not found errorWindows 8 Metro 应用程序标识符未找到错误
【发布时间】:2013-05-14 21:47:19
【问题描述】:

我在 MainPage.xaml.h 文件中声明了三个函数:

int GetOperator(Platform::String^ str);
bool IsNumber (Platform::String^ str);
bool IsOperator (Platform::String^ str);

并在我的 MainPage.cpp 文件中使用它们,但是当我尝试构建时,在我的 .cpp 文件中的这三个函数上出现“找不到标识符”错误。

它们都由第四个函数调用,该函数也在我的 .h 文件中声明,但在第四个函数上我没有收到此错误。

【问题讨论】:

  • 仅供参考。 Metro 是德国的商标,这就是它被重命名为 Windows Store Apps 的原因。只是作为一个小信息。
  • 啊,谢谢!会做出调整

标签: windows-8 c++-cx


【解决方案1】:

首先你需要将你的头文件添加到你的 cpp 文件中(你还需要在你的 IDE 中设置链接器以便编译器知道在哪里可以找到头文件)

#include "Your_headerfile.h"

之后,您还需要在 .cpp 文件/代码中声明这些功能。它被称为前向声明。编译函数调用时,编译器需要知道函数原型。

int GetOperator(Platform::String^ str);
bool IsNumber (Platform::String^ str);
bool IsOperator (Platform::String^ str);

int main()
{
   ...
   your code
   ...
}

【讨论】:

  • 能否请您详细说明您的答案,添加更多关于您提供的解决方案的描述?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-04-02
  • 2013-04-03
  • 1970-01-01
  • 2012-06-21
  • 2012-06-29
  • 1970-01-01
  • 2011-07-06
相关资源
最近更新 更多