c++ - 安装 Visual Studio 2013 后的第一个构建错误。 fatal error LNK1561 : entry point must be defined

标签 c++ visual-c++ visual-studio-2013

我想这实际上很简单,但由于我是 C++ 的新手,我无法理解我做错了什么。 大多数答案(如 this question 的答案)都表明:

project name -> Properties -> Expand Linker tab -> System -> SubSystem:

并将子系统更改为不同的类型。我试过了,但它给了我另一个错误:

fatal error LNK1120: 1 unresolved externals

所以我认为这是一种错误的方式。 当我创建项目时,我选择了 Visual C++ -> General -> Empty Project

我的主要方法是 int main();return 0;。我之前在 Eclipse 中做过,一切都很好。

拜托,我应该配置什么才能成功启动我的项目?谢谢。

这是它的样子:

#include <iostream>

using namespace std;

class Source{
    int main(){

        cout << "out" << endl;

        return 0;
    }
};

最佳答案

我想你可以把它改成:

#include <iostream>
using namespace std;

//class Source{
    int main()
    {
        cout << "out" << endl;
        return 0;
    }
//};

关于c++ - 安装 Visual Studio 2013 后的第一个构建错误。 fatal error LNK1561 : entry point must be defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30242001/

相关文章:

c# - 使用 JSON 反序列化方法时 VS 2013 崩溃

c++ - 传递对模板函数调用运算符重载的引用

c++ - 函数中未定义的参数

visual-c++ - 如何将 cudaStreamAddCallback() 与类成员方法一起使用?

c# - SQL连接字符串和cant参数visual studio 2013

asp.net-mvc - 类型或命名空间名称 'Mvc' 不存在

c++ - boost 最佳实践?

c++ - OpenMP、C++ 和迭代器

c - 如何设置 "General->TargetName"、 "Debugging->Command"和 "Linker->General->Output File"

c++ - VS2015从windows程序中删除linux上的文件