error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

Related searches

While I am running the simple code as below I have two errors as following:

#include <iostream>
#include <string>
using namespace::std;

template <class Type>
class Stack
    Stack (int max):stack(new Type[max]), top(-1), maxsize(max){}
    ~Stack (void) {delete []stack;}
    void Push (Type &val);
    void Pop (void) {if (top>=0) --top;}
    Type& Top (void) {return stack[top];}
    //friend ostream& operator<< (ostream&, Stack&);
    Type *stack;
    int top;
    const int maxSize;

template <class Type>
void Stack <Type>:: Push (Type &val)
    if (top+1<maxsize)
        stack [++top]=val;


MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

What Should I do?

Thats a linker problem.

Try to change Properties -> Linker -> System -> SubSystem (in Visual Studio).


This one helped me

LNK2019: unresolved external symbol _WinMain@16, locked. error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup RRS feed � Archived Forums V. I have started with DirectX 11 and get these compilation errors: Error 1 error LNK2019: unresolved external symbol wWinMain@16 referenced in function __tmainCRTStartup

As the others mentioned you can change the SubSystem to Console and the error will go away.

Or if you want to keep the Windows subsystem you can just hint at what your entry point is, because you haven't defined ___tmainCRTStartup. You can do this by adding the following to Properties -> Linker -> Command line:


This way you get rid of the console window.

unresolved external symbol _WinMain@16 r, 1>Linking 1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup As I mentioned in the other note, you disabled default libraries so the QuickWin support library was not linked in. You have to compile all the Fortran sources with -libs:qwin, not just put it on the link.

If you are having this problem and are using Qt - you need to link qtmain.lib or qtmaind.lib

Error 1 error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup. Error 2 error LNK1120: 1� In case someone missed the obvious; note that if you build a GUI application and use "-subsystem:windows" in the link-args, the application entry is WinMain@16.Not main().

Besides changing it to Console (/SUBSYSTEM:CONSOLE) as others have said, you may need to change the entry point in Properties -> Linker -> Advanced -> Entry Point. Set it to mainCRTStartup.

It seems that Visual Studio might be searching for the WinMain function instead of main, if you don't specify otherwise.

unresolved external symbol 'symbol' referenced in function 'function' The compiled code for function makes a reference or call to symbol , but the linker can't find the symbol definition in any of the libraries or object files to link.

Include <tchar.h> which has the line:

#define _tWinMain wWinMain

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33: #include "stdafx.h" # include <stdio.h> # include <conio.h> # include

MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup.

I am struggling to get my 1st CUDA program to build with Visual Studio 2008 under Windows 7. It compiles OK but gives the linking error: 1>LIBCMTD.lib(crt0.obj

The file extension is .cu contrary to what the the comment statement says. You really do have to rename the input to have .cu extension. nvcc uses the file extension to determine how to process the input code.

  • Is this all the code? Where is your main function?
  • Also looks like the type of project is set wrong. The linker error regarding WinMain implies you tried to create a Win32 project. If you just want something to output text to the command prompt, try changing the project type to Console.
  • By the way, if you are getting compiler/linker errors, you are not "running" the code.
  • I tried changing the project type, but project=exe worked instead of console.
  • I've got the same issue. Your answer isn't helping. Any Other suggestion?
  • I had that problem when using MS Visual Studio. If your environment is different that you might have to fix it differently. But it should still be a linker problem.
  • If you are using tWinMain as your main function, you must include tchar.h or change it to either WinMain or wWinMain depending on whether or not your app is Unicode. Failure to do so also yields this linker error even with the correct subsystem. (/SUBSYSTEM:WINDOWS)
  • This helped me, apart from that I also had to disable Avast anti-virus.
  • This worked only after I selected "all configurations" for both platform and type. Selecting "build" on the "Solution" attempted to build all and the first one tried was NOT the one had specified for console subsystem.
  • +1: "This way you get rid of the console window." - Cool! Learned sth. new today!