# \_\_\_tmainCRTStartup problem

**URL:** <https://discourse.glfw.org/t/---tmaincrtstartup-problem/392>\
**Category:** support\
**Created:** [August 28, 2006, 3:35am UTC](https://discourse.glfw.org/t/---tmaincrtstartup-problem/392 "2006-08-28T03:35:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 28, 2006, 3:35am UTC](https://discourse.glfw.org/t/---tmaincrtstartup-problem/392/1 "2006-08-28T03:35:10Z")

</div>

**nobody** wrote on [Monday, August 28, 2006](https://sourceforge.net/p/glfw/discussion/247562/thread/b01d8f3f/#d459):

Hi,  
I made the dll and lib using VC2005’s nmake and already put them in VC2005’s folder.

As for setting :  
Additional Dependencies : glu32.lib opengl32.lib glfw.lib

Here’s my source code  
\<i\>  
#include \<GL/glfw.h\>

void DrawGLScene()  
{  
}

int main()  
{  
bool running=true;  
glfwInit();

```
if\(\!glfwOpenWindow\(800, 600, 8, 8, 8, 8, 8, 0, GLFW\_WINDOW\)\)
\{
	glfwTerminate\(\);
	return 0;
\}

while\(running\)
\{
	DrawGLScene\(\);
	glfwSwapBuffers\(\);
	running = \!glfwGetKey\( GLFW\_KEY\_ESC \) &amp;&amp;
				glfwGetWindowParam\( GLFW\_OPENED \);
\}

glfwTerminate\(\);

```

}  
\</i\>

But, I got these error :  
\<i\>  
LINK : warning LNK4098: defaultlib ‘LIBCMT’ conflicts with use of other libs; use /NODEFAULTLIB:library  
1\>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol \_WinMain@16 referenced in function \_\_\_tmainCRTStartup  
1\>D:\Program Samples\GLFW\2\Debug\2.exe : fatal error LNK1120: 1 unresolved externals  
\</i\>

What should I do ? Thanks 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [August 28, 2006, 3:42am UTC](https://discourse.glfw.org/t/---tmaincrtstartup-problem/392/2 "2006-08-28T03:42:43Z")

</div>

**[melekor](https://sourceforge.net/u/melekor/)** wrote on [Monday, August 28, 2006](https://sourceforge.net/p/glfw/discussion/247562/thread/b01d8f3f/#d459/ab39):

You’re getting this error because you created the project as a “win32 application”, but you haven’t provided the WinMain function, which is the entrypoint for “win32 applications”.

Solution:

change int main()

to

int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)\
**Post date:** [September 1, 2006, 5:28pm UTC](https://discourse.glfw.org/t/---tmaincrtstartup-problem/392/3 "2006-09-01T17:28:20Z")

</div>

**[elmindreda](https://sourceforge.net/u/elmindreda/)** wrote on [Friday, September 01, 2006](https://sourceforge.net/p/glfw/discussion/247562/thread/b01d8f3f/#d459/b69e):

As CL wants to use WinMain as the entry point for Windows subsystem executables, you’ll need to tell it explicitly to use main instead. Add /entry:mainCRTStartup to your link flags and all will be well.
