Eclipse CDT 代码完成问题
由于某种原因,我正在运行的 Eclipse CDT(在 Ubuntu Linux 中)的代码完成无法正常工作。每次我添加一个库时,都不会弹出任何内容。这有什么原因吗?
For some reason the code completion for the Eclipse CDT I'm running (in Ubuntu linux) isn't working properly. Every time I include a library nothing pops up. Is there any reason why this could be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在源代码中包含标头是不够的。您需要告诉索引器在哪里查找标头。为此,您需要转到项目的属性,导航到
C/C++ General > >路径和符号
项目。在Includes
选项卡中,添加包含GNU C++
语言标头的文件夹。如果您的库需要,您可能还需要在Symbols
选项卡中定义一些符号。现在您只需等待索引器完成它的工作,自动完成功能就会开始工作。请记住,索引器并不完美,复杂的 C++ 头文件(例如 STL)很容易将其混淆。
Including a header in your source code is not enough. You need to tell the indexer where to look for the header. To do so, you need to go to your project's properties, navigate to the
C/C++ General > Paths and Symbols
item. In theIncludes
tab, add the folder containing your headers for theGNU C++
language. You may also need to define a few symbols in theSymbols
tab if your library needs it.Now you'll just have to wait for the indexer to do it's thing and auto-completion should start working. Keep in mind that the indexer isn't perfect and complicated C++ headers like the STL can confuse it pretty easily.
也许是因为它找不到标题。您必须在项目工具设置的“包含”部分中指定包含路径。其他方法可能会阻止 Eclipse 找到标头,即使 gcc 可以找到它们。
Maybe because it cannot find the headers. You have to specify the include paths in the Includes section of your tool settings for the project. Other method's may prevent eclipse from finding the headers even when gcc can find them.