如何在 Windows 上正确配置 netbeans 6.7 和 c++?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1184599/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to correctly configure netbeans 6.7 and c++ on windows?
提问by grigoryvp
I have installed and configured NetBeans 6.7 for c++ according to the official manual: http://www.netbeans.org/community/releases/67/cpp-setup-instructions.html#mingw
我已经根据官方手册为 c++ 安装并配置了 NetBeans 6.7:http: //www.netbeans.org/community/releases/67/cpp-setup-instructions.html#mingw
Configuration window looks like this:
配置窗口如下所示:
Unfortunately, at 'compile' command following line is displayed:
不幸的是,在“编译”命令中显示以下行:
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf BUILD SUCCESSFUL (total time: 642ms)
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf BUILD SUCCESSFUL(总时间:642ms)
Since i'm on windows and it's no /usr/bin/make, no executable is compiled :(. How to correctly configure NetBeans so it will use make from it's config, not from /usr/bin?
由于我在 Windows 上并且没有 /usr/bin/make,因此没有编译任何可执行文件 :(。如何正确配置 NetBeans 以便它使用来自其配置的 make,而不是来自 /usr/bin?
Updated
更新
Problem is only with mingw/msys toolchain. It works OK with cygwin (same /usr/bin/make message is displayed, but executable IS created). So the question can be changed to: Can Netbeans 6.7 work with mingw on Windows, or i'm limited to cygwin?
问题仅在于 mingw/msys 工具链。它与 cygwin 一起工作正常(显示相同的 /usr/bin/make 消息,但创建了可执行文件)。所以问题可以改为:Netbeans 6.7 能否在 Windows 上与 mingw 一起使用,或者我仅限于 cygwin?
回答by Arnold Spence
I had problems getting Netbeans 6.7.1/C++/MinGW working too. I don't know if this will help but I thought I'd describe my experience anyway.
我也遇到了让 Netbeans 6.7.1/C++/MinGW 工作的问题。我不知道这是否会有所帮助,但我想无论如何我都会描述一下我的经历。
I was having successful builds but Netbeans was unable to launch my executable. I was able to verify that the executable was being built and I could run it from an external command prompt. I was also unable to open the properties on my project.
我的构建成功,但 Netbeans 无法启动我的可执行文件。我能够验证正在构建可执行文件,并且可以从外部命令提示符运行它。我也无法打开我的项目的属性。
After a day of searching the net, I found a tidbit of info that lead to the solution.
在网上搜索了一天后,我发现了一些导致解决方案的信息。
Basically, it all boiled down to not having the path to my build tools set in the windows environment path. After I set the path environment variable, I cleared all the Netbeans configuration so I could be sure about setting things up from scratch. You can do this by deleting the .netbeans folder in your user directory in c:/Documents and Settings.
基本上,这一切都归结为没有在 windows 环境路径中设置我的构建工具的路径。设置路径环境变量后,我清除了所有 Netbeans 配置,这样我就可以确定从头开始设置。您可以通过删除 c:/Documents and Settings 中用户目录中的 .netbeans 文件夹来完成此操作。
That should all be done with Netbeans closed of course. Afterwards, start it up and setup your build configuration before you create any projects or load existing projects. Go to Tools/Options/C++ and point it at the build tools directory you added to your environment path (c:/MinGW/bin and c:/msys/1.0/bin) and the individual tools as required.
当然,这一切都应该在关闭 Netbeans 的情况下完成。然后,在创建任何项目或加载现有项目之前启动它并设置您的构建配置。转到 Tools/Options/C++ 并将其指向您添加到环境路径(c:/MinGW/bin 和 c:/msys/1.0/bin)的构建工具目录和所需的各个工具。
I have my msys stuff in the same directory as the MinGW stuff. As an extra precaution, you may want to make sure there are no same named programs in both bin directories that may cause grief.
我的 msys 内容与 MinGW 内容位于同一目录中。作为额外的预防措施,您可能需要确保两个 bin 目录中没有可能导致悲伤的同名程序。
I seem to have a C++ development environment now that I'm quite pleased with as I can use it in Windows and Linux. Hope something in there helps.
我现在似乎有一个 C++ 开发环境,我很满意,因为我可以在 Windows 和 Linux 中使用它。希望里面的东西有帮助。
回答by Milan
Can you check on the "project options" on your picture and look if the default platform is windows ?
您可以检查图片上的“项目选项”并查看默认平台是否为 windows 吗?
Have installed netbeans on both linux and windows machines and it's strange that it didn't work "straight out of the box" after following the instructions..
已经在 linux 和 windows 机器上安装了 netbeans,奇怪的是它在按照说明“开箱即用”后无法正常工作。
You did double check everything right? As it seems that path variable isn't setup correctly in your environment.
你确实仔细检查过一切吗?因为您的环境中似乎没有正确设置路径变量。
The picture also says that the debugger is missing/invalid.. Did you follow these 16 steps(step 14 for installing debugger) or did you use something else?
图片还说调试器丢失/无效..您是否遵循了这 16 个步骤(安装调试器的第 14 步)还是使用了其他东西?
Last but not least, your "error" message says that the build was successful. Where did you look for the .exe ? It should be under
最后但并非最不重要的是,您的“错误”消息表明构建成功。你在哪里找的 .exe ?它应该在
dist/<Configuration>/<ToolChain>/
dist/<Configuration>/<ToolChain>/