Frage

I have a created a program starts with OS_main instead if int main

OS_MAIN()
{
    // it is performing some function calls here
}

If i run my program : I am getting linker error as

LNK2019: unresolved external symbol_main referenced in function_tmainCRTStartup.

how to solve this error ??

I am using microsoft visual studio IDE.

War es hilfreich?

Lösung

Linker errors happen when the definition of a function or variable that is being used cannot be found. If you have this preprocessor definition somewhere...

#define OS_MAIN main

...and you're doing this...

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

... that is fine, however, if you're using OS_MAIN instead of main that won't work. Every program needs a main. That is where every program starts.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top