visual studios express 2013 errors
visual studios express 2013 errors
每次
我制作新程序时都会在编译时出现此错误,以前我使用 2012 并且从未遇到过这个问题,但现在我每次都看到这个:
错误:
Error 2 error LNK2019: unresolved external symbol
"public: __cdecl lonework::App::App(void)" (??0App@lonework@@Q$AAA@XZ)
referenced in function "public: void __thiscall <lambda_b6bf150325cab1ba448790bcac21fea0>::operator()(class Windows::UI::Xaml::ApplicationInitializationCallbackParams ^)
const " (??R<lambda_b6bf150325cab1ba448790bcac21fea0>@@QBEXP$AAVApplicationInitializationCallbackParams@Xaml@UI@Windows@@@Z) C:UsersLoganDocumentsVisual Studio
2013Projectsloneworkloneworklonework.WindowsXamlTypeInfo.g.obj lonework.Windows
当前处理的代码:
#include <pch.h>
#include <conio.h>
#include <stdio.h>
#include <Windows.h>
int yes();
int no();
int main()
{
char choice;
printf("Think of a number between one and tenn");
Sleep(2000);
printf("Got it yet?n Y/N ");
scanf_s("%c", &choice,1);
if (choice == 'y' || choice == 'Y')
{
printf("That's good");
yes();
}
else if (choice == 'n' || choice == 'N')
{
printf("Are you really that slow");
no();
}
getchar();
return 0;
}
int yes()
{
printf("Good for you, keep thinking about it...n");
printf("Now think of another one, a different onen Got it?n I'll assume yes, sounds good.n Now I'll tell you your number.n");
printf("...n");
Sleep(2000);
printf("...n");
Sleep(2000);
printf("Ahem, 3 and 7");
return 0;
}
int no()
{
printf("Alright, back to the top.n");
main();
return 0;
}
请确保在创建新项目时选择空项目或C++控制台应用程序,而不是托管C++应用程序。
对于此代码,您无需include pch.h
,实际上VS没有附带此类文件。
有两种方法可以纠正此问题
1.) 在 VS 中单击
- 为项目命名
- 创建一个新的C++项目,
- 选择
Win32 Application
, - 取消选中
precompiled header
, - 取消选中
Security Development Lifecycle (SDL) checks
, - 单击完成
- 将创建一个新项目,并将打开带有您的项目名称的 cpp 文件。
- 复制并粘贴此源代码并删除行
#include <pch.h>
现在您可以编译并运行它。
或
2.)在包含此项目的VS解决方案中:
-
右键单击解决方案资源管理器中的项目名称
-
单击
Properties
单击左侧的C/C++
选项卡 -
单击"预编译标头"
-
在列
Precompiled headers
右侧,从use
更改为Not Using Precompiled Headers
-
点击应用图标
-
现在,如果您使用的是Visual Studio Community,您将拥有一个文件名为"
AssemblyInfo
",右键单击该文件并将其删除,然后选择"删除" -
现在删除第一行
#include <pch.h>
编译并运行它
实际上您正在用Visual C++编译C代码,因此,当您创建新项目时,您必须取消选中SDL检查(安全开发生命周期)
另一种简单的方法是创建一个新的blank C++ project
,在解决方案资源管理器上右键单击source files
。 单击add
,单击new item
,选择C++ File
,现在将代码粘贴在其中并运行它。如果您正在开始新项目,这是最简单的方法。
相关文章:
- 使用 GCC 卸载的 OpenMP 卸载失败,并出现"Ptx assembly aborted due to errors"
- 如何递归地解决USACO 2013-周长-银
- 将"libpqxx"与Visual Studio 2013链接/安装,以便与PostgrSQL建立C++连接
- Visual Studio 2013,错误 MSB8020:找不到 Visual Studio 2010 的生成工具
- 为什么在Visual Studio 2013上的std::this_thread::sleep_for上死锁
- Visual Studio Professional 2013, Update 5, "No Target Architecture"
- Opencv在2013年第5季度不起作用.应用程序总是在窗口中崩溃
- 构建在VS 2013中找不到平台工具集= 'v141'
- 性能报告 (.vspx) 在 Visual Studio 2013 中未打开(显示损坏)
- 如何在"XAML for Windows Embedded (Compact 2013)"中切换图像
- 这是MSVC 2013中具有共享PTR的单例的正确实现吗?
- 在 Visual Studio 2013 中使用零大小数组C++
- MFC 对话框属性表用法在 VS 2017 中产生错误,适用于 VS 2013
- Visual Studio 2013 标头包含失败
- 是与视觉C 2017二进制文件兼容的Visual C 2013二进制文件
- C /FORTRAN项目由Visual Studio 2010/Intel 2013创建,将不会在Visual St
- Visual studio 2013 和 g++ 7.1 中将 int 和 long 类型相乘时的 c++ 差异行为
- SDL errors Visual Studio 2013
- visual studios express 2013 errors
- Visual Studio 2013 - C++ Errors