I have newbie question that concerns IDA pro and Visual studio 2010. Basically I started a new "Empty Project" in VS 2010 and added a main function to the .cpp file. Then I compiled it to binary and opened up the binary using IDA Pro. However, I could not locate the main function. Why is that?
Open Exports view in IDA (Views-->Open subviews-->Exports). You'll see there one function name. It is the real main function of the program (which is possibly not your main function, but your main function will be called somehow from it).
Actually you can not find main function by name because this information does not exist in the executable: the computer doesn't need it for program execution. Information about function, variable and type names and relation between CPU instructions and lines of real source code called "debug information" and stored in different place, which is .PDB file in your specific case.
So if you compiled your program with debug information (which is default) loading .PDB file (File-->Load File-->PDB file) will possibly be helpful.
start is the address that IDA pulls from the file header. For PE files this corresponds to (AddressOfEntryPoint + ImageBase). start != main, main is language (C/C++) specific requirement, not all languages require "main".
One of the jobs of the code that executes between start and main is to setup all the arguments that main expects (argc, argv, envp) in the manner that main expects to receive them according to the calling conventions of the platform for which the binary was built.
IDA attempts to locate main for you because you are often not interested in the code between start and main which is generally just compiler boiler plate code. In some cases IDA will note that there is a symbol named main and just drop you there. In other cases, IDA does what is effectively signature matching against the start code to pick out the address of main. Compilers tend to have unique ways of reaching main, so if (a big if) IDA has a signature for a specific compiler, then it may be able to pick main out for you.
You don't mention whether you are using IDA on the Debug or Release version of your binary. In my experience with IDA/Visual Studio, IDA will have a tough time finding main on Debug builds and does a better job on Release builds. If you compare the two different .exe files, you will see that they are vastly different. Specifically flow through Debug builds is much more complicated than through Release builds.
In IDA, view 'functions' and look for 'start'.
Sometimes the IDA signatures can't identify the main() function. In this case, you will have to trace it manually from the program's Entry Point, though the sigs have improved over the years, they usually are able to identify main correctly.
How you get to main() also depends also on whether you are linking to the standard Visual Studios libraries or not (I can't remember if the Empty Project does by default or not).