visual studio c++ error link1120
visual studio c++ error link1120
我在visual studio 2013中编写了一个c++程序程序是非常简单的一个,当我编译有错误这是我第三次看到这个错误了。程序如下:
#include <iostream>
using namespace std;
int main()
{
int x, y, z = 0;
char c;
bool quit = true;
while (quit == true)
{
cout << "enter a number : ";
cin >> x;
cout << "enter a sign : ";
cin >> c;
cout << "enter another number : ";
cin >> y;
if (c == '+')
z = x + y;
if (c == '-')
z = x - y;
if (c == '*')
z = x * y;
if (c == '/' && y != 0)
z = x / y;
if (c == 'q')
quit = false;
cout << "Answer is : " << z << endl;
}
return 0;
}
…这里是错误:
1>------ Build started: Project: Calculator_madeByMe, Configuration: Debug Win32 ------
1> Source.cpp
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:UsersSorenadocumentsvisual studio 2013ProjectsCalculator_madeByMeDebugCalculator_madeByMe.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========>
作为Windows应用程序编译,它在调用入口点时不使用"int main()"签名。
在项目->属性->链接器->系统->子系统->控制台中切换到控制台应用程序。可能会涉及到比这个设置更多的东西,所以如果它仍然不能编译,重做你的项目,并确保选择Console Application。
相关文章:
- "error: no matching function for call to"构造函数错误
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 使用 LuaBridge 将 LuaJIT 绑定到C++会导致"PANIC: unprotected error"
- OpenMP卸载说'fatal error: could not find accel/nvptx-none/mkoffload'
- C++错误:"error: int aaa::bbb is protected within this context"
- 尝试链接我的着色器时,我收到错误代码"error c5145 must write to gl_position"
- C++,在int数组中输入字符串或字符会输出0,而不是ascii或error
- 使用 cmake 的 LLVM 构建在 tsan_libdispatch_mac.cc 期间失败; "Error: conflicting types for ..."
- C++ "error: invalid use of void expression"
- struct.error:解压缩 C++ 结构时,解包需要 288 字节的缓冲区
- 如何修复"error: ‘_1’ was not declared in this scope"?
- 从不同目录执行时"symbol lookup error:",否则从构建目录执行时按预期工作
- 对象声明中的模板"error: expected expression"
- 在C++中使用 Catch 测试框架编译错误"error: expected ';' at end of declaration list"
- OpenCV 3.4.1 error readNetFromTensorflow 无法在 cv::d nn::ReadProtoFromBinaryFile 中打开 .pb
- 已解决 - C++ 的崇高文本中的"fatal error: opencv: no such file or directory"
- 为什么我会"error: expected expression"?
- CMake Error at modules/videoio/cmake/detect_ffmpeg.cmake:16
- 如果两个静态库使用相同的另一个静态库,如何避免"LNK2005 Already Defined error"?
- visual studio c++ error link1120