SDL2:LNK1561:必须定义入口点 [英] SDL2: LNK1561: entry point must be defined

查看:253
本文介绍了SDL2:LNK1561:必须定义入口点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编译以下代码:

#include <SDL.h>

int main(int argc, char* argv[]) {
    return 0;
}

但无法链接:错误1错误LNK1561:必须定义入口点

此库中有一些奇怪的代码: http://hg.libsdl.org/SDL/file/75726efbf679/include/SDL_main.h

There is some strange code in this library: http://hg.libsdl.org/SDL/file/75726efbf679/include/SDL_main.h

#define main    SDL_main

我还添加了 SDL2.lib; SDL2main.lib 到项目设置=>链接器=>输入。

Also I added SDL2.lib;SDL2main.lib to Project Settings => Linker => Input.

运行该项目该怎么办?

VS 2012 SP3,空的C ++项目。

What can I do to run this project?
VS 2012 SP3, empty C++ project.

推荐答案

根据此线程在Dream.In.Code上:

According to this thread on Dream.In.Code:


右键单击项目名称->属性->展开链接器选项卡->系统->子系统:确保它是控制台(/ SUBSYSTEM:控制台)

或者,如果您要隐藏控制台窗口或调试多线程应用程序,应将SubSystem设置为窗口(/ SUBSYSTEM:WINDOW)代替。

Alternatively, if you want to hide the console window or are debugging a multithreaded application, you should set the SubSystem to Window (/SUBSYSTEM:WINDOW) instead.

这篇关于SDL2:LNK1561:必须定义入口点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆