在Code :: Blocks中更改main方法?

时间:2013-05-15 07:58:43

标签: c++ winapi codeblocks

我从 main 切换到 WinMain ,Code :: Blocks正在搜索 main 。我该如何解决?这可能是一个愚蠢的问题,但我无法在网上找到它。

更新@JBL

#include <iostream>
#include "def.h" //This defines a few things
#include <windows.h>
#include <gl/gl.h>
#include "glcontext.h" //This defines some OpenGL/Win32 functions

using namespace std;

BOOL WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow)
{

 }

1 个答案:

答案 0 :(得分:1)

如果将以下内容添加到Microsoft链接器选项:

/ subsystem:windows / ENTRY:WinMainCRTStartup注意这对GNU工具链来说不是必需的。

仍然可以使用Microsoft工具将其添加到主文件中:

。#ifdef _MSC_VER 。#pragma comment(链接器,“/ subsystem:windows / ENTRY:WinMainCRTStartup”) #ENDIF

相关问题