NetBeans 7 c++远程开发主机包含路径

发布于 2024-11-17 17:24:18 字数 536 浏览 3 评论 0原文

也许这有点深奥,让我们看看它是如何进行的。

我正在 Windows 7 x64 机器上使用 NetBeans 7 编写一个 C++ 程序,但在远程开发主机上构建,该主机实际上是在 VirtualBox 4 上运行的 Ubuntu Server 10.4 x64 虚拟机。

源文件使用 VirtualBox 共享文件夹共享。我已经能够毫无问题地创建、构建和调试项目。

然而,NetBeans 的代码辅助功能不断抱怨找不到我的包含文件,因此我在每个函数调用时都会收到代码辅助“无法解析标识符”错误。

这并不奇怪,因为包含文件实际上位于 /usr/include 中,它不是共享文件夹方案的一部分,因此 NetBeans 不能直接读取它们(它可以而且应该读取它们)不过使用 ssh)。但我希望 NetBeans 允许我设置远程目录以进行代码辅助。我查看了许多设置,但没有找到与我正在寻找的内容类似的内容。

当然,可以忽略这个错误,但除了我近乎强迫症之外,这与禁用代码辅助相同,当 IDE 告诉我有关拼写错误或其他可以完成的事情时,我真的很感激代码协助。

有什么想法吗?

Maybe this is a little bit esoteric, let's see how it goes.

I'm writing a c++ program using NetBeans 7 on a Windows 7 x64 box, but building on a remote development host, which is actually an Ubuntu Server 10.4 x64 virtual machine running on VirtualBox 4.

Source files are shared using VirtualBox shared folders. I've been able to create projects, build and debug them with no problems.

However, the code assist features of NetBeans keep on complaining that none of my include files can be found, and therefore I get a code assist "unable to resolve identifier" error for every single function call.

This is not very surprising, as the include files are actually in /usr/include, which is not part of the shared folder scheme, and therefore are not directly readable by NetBeans (it can and should read them using ssh though). But I would expect for NetBeans to allow me to set remote directories for code assist. I've looked through many settings and haven't found anything resembling what I'm looking for.

Sure, it's possible to just ignore this errors, but apart from me being near-OCD, that would be the same as disabling code assist, and I really appreciate it when the IDE tells me about a typo or other things that can be done with code assist.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假扮的天使 2024-11-24 17:24:18

您可能想在 Netbeans 中尝试以下设置,这解决了我在远程主机上的代码辅助问题:

1) 项目构建设置

a - 右键单击​​项目窗格中的项目,选择“属性” b

- 展开“构建”并单击“C++ 编译器”

c - 在“包含目录”中,确保在顶部设置了正确的配置(调试或发布),单击“...”打开“包含目录”目录”窗口

d - 放置完整的包含目录的路径。请注意,当您单击“选择”时,Netbeans 将自动在前面添加 Windows 路径信息。由于您是在远程 Linux 主机上进行开发,因此现在必须单击“编辑”按钮并编辑此路径以类似于 Linux 文件路径(不带 C:)

2) Netbeans 代码辅助选项

a -在 Netbeans 菜单栏中,单击“工具”,然后单击“选项”

b - 单击顶部的“C/C++”,然后选择“代码帮助”选项卡

c - 确保“工具集合”设置为正确的远程主机位于顶部

d - 对于bot 的“C 编译器”选项卡和“C++ 编译器”选项卡,单击“添加”并手动键入您希望 Code Assist 建立索引的目录的完整路径。

e - 同样,当您单击“选择”时,Netbeans 将自动在前面添加 Windows 路径,并且将斜杠更改为 Windows 斜杠(呃)...所以现在您必须单击“编辑”并编辑这些路径以表示正确的 Linux 语法

希望这有帮助!

You might want to try the following settings in Netbeans, which solved my problem of code assist on remote hosts:

1) Project Build Settings

a - Right-click on the project in the project pane, select "Properties"

b - Expand "Build" and click "C++ Compiler"

c - In the "Include Directories", make sure you set the correct Configuration (Debug or Release) at the top, click the "..." to open the "Include Directories" window

d - Put the full path of the include directory. Notice that when you click "Select", Netbeans will automatically prepend the Windows path information. Since you are developing on a remote Linux host, you must now click the "Edit" button and edit this path to resemble the Linux file path (without the C:)

2) Netbeans Code Assistance Options

a - In the Netbeans menu bar, click "Tools" and then "Options"

b - Click "C/C++" at the top, then select the "Code Assistance" tab

c - Make sure the "Tool Collection" is set to the proper remote host at the top

d - For bot the "C Compiler" tab and the "C++ Compiler" tab, click "Add" and manually type the full path to the directory you want Code Assist to index.

e - Again, when you click "Select", Netbeans will automatically prepend the Windows path PLUS change the slashes to Windows slashes (ugh)... so now you must click "Edit" and edit those paths to represent the correct Linux syntax

Hope that helps!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文