The question may apply to any programming language written in Visual Studio, but I am more concerned about C++.
Is there a way to easily determine the application entry point in Visual Studio?
For a relatively small application this could be easy, but for large ones, it will be pretty hard. In my particular case I know that the project which is set as startup is the one which has the entry point, but I was unable to find it, even though the application starts and runs well.
Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio. Select the Configuration Properties > Linker > Advanced property page. Modify the Entry Point property.
The main function ( main() ) is the entry point to a C/C++ program and is called when the application starts executing. Calls to other functions, for example from the main function, provide entry points to function code. Program control is transferred to the called function.
The WinMain function is identical to wWinMain, except the command-line arguments are passed as an ANSI string. The Unicode version is preferred. You can use the ANSI WinMain function even if you compile your program as Unicode. To get a Unicode copy of the command-line arguments, call the GetCommandLine function.
If you want to find what C++ project is executable than search for <ConfigurationType>Application</ConfigurationType>
in all your *.vcxproj
files.
If you are looking for the entry point function inside this application, than search for main
, wmain
or WinMain
functions.
Also entry point can be redefined with /ENTRY
parameter, so you can check Configuration Properties > Linker > Advanced > Entry Point
project parameter or search for /ENTRY
in your *.vcxproj
.
In C++, a fully compiled program can have only one defined main
method. If there's more than one, the compiler will complain about "multiple definitions of main" or some other similarly worded message.
So, the simplest option is to do a search for the symbol main
(or, if compiling as a Windows Subsystem program, WinMain
) and figure out which ones correspond to the "startup" project. There shouldn't be that many, even in a relatively large solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With