简体   繁体   English

Visual Studio转到定义

[英]Visual Studio Go to Definition

Go To definition in Visual studio 2005 works only for files that are in my project. Visual Studio 2005中的Go To定义仅适用于项目中的文件。 It never works for files that are included in external libraries like mfc. 它永远不适用于像mfc这样的外部库中包含的文件。 When I say Go To Definition for mfc function it always shows me the header file . 当我说mfc函数的Go To Definition时,它总是显示头文件。 Is this expected behavior? 这是预期的行为吗? And also how does this whole thing Go To Definition work? 此外,Go To Definition的工作原理如何? Thanks 谢谢

I'd make the small investment required in Visual Assist . 我需要在Visual Assist中进行小额投资。 Besides all the great features it offers, it has the Alt+G command which works way better than the Visual Studio go to definition :) 除了它提供的所有强大功能外,它还具有Alt + G命令,其工作方式比Visual Studio更好用于定义:)

External libraries are references to their compiled DLLs rather than the source when referencing your own projects. 外部库是引用其编译的DLL而不是引用您自己的项目时的源。

The idea is that you don't need any more than the interface to external classes, 这个想法是你不需要外部类的接口, but, if you would like to see the internals of DLLs you can use a tool such as Reflector . 但是,如果你想看到DLL的内部,你可以使用像Reflector这样的工具。

For the MFC source files (at least the Feature Pack ones) I learned to find out what folder are they in (usually at C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\mfc ) and add that folder to the Find in Files dialog. 对于MFC源文件(至少是Feature Pack文件),我学习了解它们所在的文件夹(通常在C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\mfc )并将该文件夹添加到“在文件中查找”对话框。

It's not as direct as Go to Definition, and you may have to browse among the find results, but it works... 它不像Go to Definition那样直接,你可能需要在搜索结果中浏览,但它有效......

Note: I second @flippy's answer of Visual Assist, it's really great. 注意:我的第二个@flippy的Visual Assist答案,它真的很棒。

是的,只有MFC的接口将在头文件中给出。除非使用模板实现,否则您将无法访问实际定义.dll具有这些接口的实现。

Well if you think about it logically, as far as visual studio knows the only definition of the MFC object that is available is the definition it sees in the associated MFC header file, so unless you actually have the entire source for MFC it won't be able to look anywhere else. 好吧,如果你从逻辑上考虑它,只要visual studio知道可用的MFC对象的唯一定义是它在相关的MFC头文件中看到的定义,所以除非你实际拥有MFC的整个源,否则它不会能够看到别的地方。

The way that intellisense/go to definition works is via a file that is created when you compile the application. intellisense /去定义的工作方式是通过编译应用程序时创建的文件。 It stores a mapping between variables/functions and where they are declared (or could potentially be declared, in polymorphic situations), and when you right click to say "go to definition" it references that file. 它存储变量/函数之间的映射以及声明它们的位置(或者可能在多态情况下声明),当您右键单击说“转到定义”时它会引用该文件。

Yes this is the expected behavior. 是的,这是预期的行为。 Only the declarations (header files) of the MFC code are available on your box and hence that is the only location that it can take you to. 只有您的盒子上有MFC代码的声明(头文件),因此这是它可以带您到的唯一位置。

What are you expecting it to show? 你期待它展示什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 转到Visual Studio中的定义 - 接口 - Go To Definition in Visual Studio - Interfaces 在Visual Studio中是否与“转到定义”相反? - Is there an opposite to 'go to definition' in Visual Studio? 视觉工作室或Symfony原子:转到定义| 宣言 - visual studio or atom with Symfony : go to definition | declaration 如何在 Visual Studio 中为索引器“this[]”“转到定义” - How do I “go to definition” for the indexer `this[]` in Visual Studio 如何在不使用鼠标单击的情况下在 Visual Studio 中执行“转到定义” - How perform "Go To Definition" in Visual Studio without using mouse click Visual Studio 的“转到定义”转到了错误的函数/行? - Visual Studio's "go to definition" goes to a wrong function/line? 转到定义并查找所有引用在Visual Studio中不起作用 - Go to definition & Find all references do not work in Visual Studio Visual Studio的“转到定义”不适用于JavaScript库 - Visual Studio's 'Go To Definition' doesn't work on javascript libraries 为什么Visual Studio转到未定义的某些变量的定义? - Why does Visual Studio go to the definition of SOME variables that are not defined? Visual Studio 2017 - 转到定义转到 .h 文件而不是 .cpp - Visual Studio 2017 - Go To Definition goes to .h file instead of .cpp
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM