在另一个文件中定义函数后,Visual Studio 无法识别该函数
After defining a function in another file, visual studio does not recognize the function
我正在创建具有许多页面(拆分为文件(的Windows控制台应用程序。我在执行程序时遇到问题,Visual Studio抛出'startpage' identifier not found
错误(startpage是函数,文件名是startpage.h(
我试过使用: external int startpage();
和 int startpage();
.我也尝试只更改函数名称(因此文件和函数不使用相同的名称(。
我不知道为什么会这样。其他具有不同功能的文件正在工作。文件 "startpage.h" 使用其他文件中定义的两个函数,这些函数不会引发任何错误。
#include "include/startpage.h"
#include <iostream>
#include <conio.h>
#include "include/concol.h"
#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
startpage();
}
```
这是错误:
Error code: C3861: 'startpage' identifier not found
#include"pch.h"移到顶部。编译器忽略包含预编译标头以上的所有内容。– 伊戈尔·坦德特尼克
这奏效了!非常感谢你们!
相关文章:
- Visual Studio中的函数声明和函数定义问题
- 在函数中使用 const int size 参数创建数组会在 Visual Studio 中抛出错误 C++:表达式的计
- Visual Studio 中的 sqrtf 函数替代
- 我可以在Visual Studio 2019上的项目下使用多个主函数吗?
- Visual Studio 无法解决类和命名空间中重载的明确函数
- 如何使用Visual Studio 2008将字符串映射到函数?
- 如何在类模板的成员函数中正确调用函数对象?正在生成 Visual Studio 编译器错误 C2440
- 请参阅在 Visual Studio 2019 中捕获 std::exception 时对函数模板实例化消息的引用
- 无法在clang Linux中分配非静态成员函数,但我可以在Visual Studio Windows中分配
- Visual Studio在创建类时不再生成构造函数/解构器
- 使用函数从 Visual Studio 2017 中的 main 创建和初始化数组
- C++ Visual Studio 重载函数错误:没有重载函数的实例与指定的类型匹配
- 为什么Visual Studio允许我在模板函数中使用私有成员(C++)?
- 在Visual Studio中,与std::async一起使用时不调用"thread_local"变量"析构函数,这是一个错误吗?
- CGAL 绘制函数在 Visual Studio 中给出'CGAL_USE_BASIC_VIEWER is not defined'错误
- 如何在 Linux 中运行 Visual Studio 2015 托管 c++ 测试函数?
- Wow64DisableWow64FsRedirection() 函数在窗口 10 的 Visual Studio 中编
- Lapack函数DGTSV通过C /Visual Studio提供未解决的外部符号
- variadic函数和折叠表达:试图在Visual Studio 2017中编译时致命误差
- 为什么Visual Studio无法在模板类中选择正确的构造函数