简单程序"LNK1561 entry point must be defined"
"LNK1561 entry point must be defined" for simple program
这是我的代码:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int x;
int y = pow(2, x);
cin>>x;
cout<< y;
system("pause");
return 0;
}
为什么我会出现编译错误?LNK1561 entry point must be defined
我正在使用Visual Studio学习版。
在使用之前,您需要为x分配一个值
int x;
int y = pow(2, x); // <--- what is the value of x here?
首先尝试从输入中获取x
的值。
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int x;
cin >> x;
int y = pow(2, x);
cout<< y;
system("pause");
return 0;
}
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int x;
//int y = pow(2, x);//(1)
//cin>>x;//(2)
//exchange the lines (2) and (1)
cin>>x;//(2)
int y = pow(2, x);//(1)
cout<< y;
system("pause");
return 0;
}
相关文章:
- 使用模板进行堆栈实现; "name followed by :: must be a class or namespace"
- C++/SDL "initial value of reference to a non-const must be an lvalue"
- C++复制函数重载导致"must be a nonstatic member function"错误
- C++ 错误:"array must be initialized with a brace-enclosed initializer"
- "expression must be a modifiable lvalue"是什么意思?
- 当两个成员位于同一类中时出错"a nonstatic member reference must be relative to a specific object"
- "[ptr, ptr+len) must be a valid range"是什么意思?
- 谷歌模拟 - 怎么说"function must be called ONCE with a certain parameter but ok to be called many times with
- 如何解决访问不同功能的"nonstatic member reference must be relative to a specific object"
- 为什么我的某些数据成员"expression must be an lvalue or a function designator"收到此错误?
- "Member function must be called or its address taken in function" C++错误
- "uses of target_link_libraries must be either all-keyword or all-plain"
- Visual Studio C++ test "name must be a namespace name" error
- 为什么我会看到"member function with the same name as its class must be a constructor"?
- 如何修复"initial value of reference to non-const must be an lvalue?"
- 产生错误"expression must be a modifiable lvalue"
- WxWidgets Hello World 编译失败:"wchar_t must be available"
- 获取此地址时出现"expression must be an l-value or function designator"错误
- 在这种情况下如何解决"Reference to non-static member function must be called"?
- 为什么我会收到错误"parameter pack 'F' must be at the end of the template parameter list"