Cannot "Go To Definition" in Visual C++ 2013

504 views Asked by At

In Visual C++ 2013 Professional, when I right-click CWinApp::Run(), an MFC function, in the afxwin.h header file and choose "Go To Definition" in the context menu, nothing comes up. The definition is also unavailable on this function's MSDN article. How can I fix the problem and find the definition? What would cause definitions to be unavailable?

3

There are 3 answers

0
Barmak Shemirani On BEST ANSWER

You can put a break point on any MFC function then debug it, and step in to the function (F11 key or "Step in" command). This will take you directly to source code, most of the time.

In this case, you may be redirected to this file for VC 2013:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\src\mfc\appcore.cpp

1
Brazil Rules On

What Error is shown in the console?

All i can say to help is that you are suposed to call that function in a while loop, like this:

while(CWinApp::Run()){
    //application code goes here...
}
7
cehnehdeh On

You can't go to a definition of a function that exists in the MFC, you don't have access to the debugging information. Generally, you're only going to be able to access the definition of functions you have the source for. You can access the declarations, that's what you see in the header file.

As far as some problem you have, I'd lean toward your own code having a problem, not something in the MFC.