65.9K
CodeProject is changing. Read more.
Home

static variables causing problem in console applications

starIconstarIconstarIconstarIconstarIcon

5.00/5 (1 vote)

Mar 20, 2012

CPOL
viewsIcon

7216

sometimes console applications give runtime error when you declare static varialbes, so here is a solution how to deal with it

Introduction

Have you ever faced the problem of declaring static variables in a console application causing a crash or memory error?

Then here is..

The Solution

Just declare mainCRTStartup as the entry point for you exe.  You can do it in the Linker->Advance Tab if you are using Visual Studio 2005

Acknowledgements

Mr. Saiful Alam (Enosis Solutions) for the R&D and solution

History

Tip uploaded : 20th March, 2012