如何添加库包含在Windows NetBeans和gcc的路径? [英] How to add a library include path for NetBeans and gcc on Windows?

查看:246
本文介绍了如何添加库包含在Windows NetBeans和gcc的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何添加库包含在Windows NetBeans和gcc的路径?

How to add a library include path for NetBeans and gcc on Windows?

使用:


  • 的NetBeans 7.1.2

  • MinGW的(的MinGW-GET-研究所-20120426.exe

  • GCC 4.7.0

推荐答案

例如,你想添加的目录中 C:\\ Program Files文件(x86)的\\实例\\ 1.0 \\包括\\ 作为包含路径。

For example, you want to add the directories in C:\Program Files (x86)\Example\1.0\include\ as the include paths.

首先,设置code帮助:

First, set up code assistance:


  • 的NetBeans>工具>选项> C / C ++> code援助

    • C编译器>包含目录:

      • C:\\ Program Files文件(x86)的\\实例\\ 1.0 \\ \\包括共享

      • C:\\ Program Files文件(x86)的\\实例\\ 1.0 \\包括\\其他

      • C:\\ Program Files文件(x86)的\\实例\\ 1.0 \\包含

      • C:\\ MinGW的\\ lib目录\\ GCC \\的mingw32 \\ 4.7.0 \\包含

      • C:\\ MinGW的\\包含

      • C:\\ MinGW的\\ lib目录\\ GCC \\的mingw32 \\ 4.7.0 \\包括固定

      • ...

      • NetBeans > Tools > Options > C/C++ > Code Assistance
        • C Compiler > Include Directories:
          • C:\Program Files (x86)\Example\1.0\include\shared
          • C:\Program Files (x86)\Example\1.0\include\other
          • C:\Program Files (x86)\Example\1.0\include
          • C:\MinGW\lib\gcc\mingw32\4.7.0\include
          • C:\MinGW\include
          • C:\MinGW\lib\gcc\mingw32\4.7.0\include-fixed
          • ...

          • C:\\ Program Files文件(x86)的\\实例\\ 1.0 \\ \\包括共享

          • C:\\ Program Files文件(x86)的\\实例\\ 1.0 \\包括\\其他

          • C:\\ Program Files文件(x86)的\\实例\\ 1.0 \\包含

          • C:\\ MinGW的\\ lib目录\\ GCC \\的mingw32 \\ 4.7.0 \\包括\\ C ++

          • C:\\ MinGW的\\ lib目录\\ GCC \\的mingw32 \\ 4.7.0 \\包括\\ C ++ \\的mingw32

          • C:\\ MinGW的\\ lib目录\\ GCC \\的mingw32 \\ 4.7.0 \\包括\\ C ++ \\落后

          • C:\\ MinGW的\\ lib目录\\ GCC \\的mingw32 \\ 4.7.0 \\包含

          • C:\\ MinGW的\\包含

          • C:\\ MinGW的\\ lib目录\\ GCC \\的mingw32 \\ 4.7.0 \\包括固定

          • ...

          • C:\Program Files (x86)\Example\1.0\include\shared
          • C:\Program Files (x86)\Example\1.0\include\other
          • C:\Program Files (x86)\Example\1.0\include
          • C:\MinGW\lib\gcc\mingw32\4.7.0\include\c++
          • C:\MinGW\lib\gcc\mingw32\4.7.0\include\c++\mingw32
          • C:\MinGW\lib\gcc\mingw32\4.7.0\include\c++\backward
          • C:\MinGW\lib\gcc\mingw32\4.7.0\include
          • C:\MinGW\include
          • C:\MinGW\lib\gcc\mingw32\4.7.0\include-fixed
          • ...

          C:\\ MinGW的\\ ... 目录仅供参考。实际上不添加。 NetBeans的应检测并自动添加MinGW的目录。如果没有,请尝试重新设置:

          The C:\MinGW\... directories are examples only. Do not actually add them. NetBeans should have detected and added the MinGW directories automatically. If not, try resetting the settings:


          • 的NetBeans>工具>选项> C / C ++

            • code援助

              • C编译器>重置设置

              • C ++编译器>重置设置


              • 恢复默认值

              有关自动code帮助的说明现有的资源,请参见:

              For instructions on automatic code assistance for existing sources, see:


              • C / C ++项目快速入门教程:

              • C/C++ Projects Quick Start Tutorial:

              <一个href=\"http://netbeans.org/kb/docs/cnd/quickstart.html#makefileprojects\">http://netbeans.org/kb/docs/cnd/quickstart.html#makefileprojects

              如何配置code援助当从现有的code创建项目:

              How to Configure Code Assistance When Creating a Project from Existing Code:

              <一个href=\"http://netbeans.org/kb/docs/cnd/configuring-$c$c-assistance.html\">http://netbeans.org/kb/docs/cnd/configuring-$c$c-assistance.html

              现在,配置项目选项:


              • 右键单击项目>属性

                • 配置:其中,所有配置>

                • 构建

                  • C编译器

                    • 常规

                      • 包含目录:

                        • C:\\ Program Files文件(x86)的\\实例\\ 1.0 \\ \\包括共享

                        • C:\\ Program Files文件(x86)的\\实例\\ 1.0 \\包括\\其他

                        • C:\\ Program Files文件(x86)的\\实例\\ 1.0 \\包含

                        • Right click on project > Properties
                          • Configuration: <All Configurations>
                          • Build
                            • C Compiler
                              • General
                                • Include Directories:
                                  • C:\Program Files (x86)\Example\1.0\include\shared
                                  • C:\Program Files (x86)\Example\1.0\include\other
                                  • C:\Program Files (x86)\Example\1.0\include

                                  • 附加选项:

                                    • -std = C11 -g3 -pedantic -Wall -Wextra -O0

                                    • Additional Options:
                                      • -std=c11 -g3 -pedantic -Wall -Wextra -O0

                                      • 常规

                                        • 包含目录:

                                          • C:\\ Program Files文件(x86)的\\实例\\ 1.0 \\ \\包括共享

                                          • C:\\ Program Files文件(x86)的\\实例\\ 1.0 \\包括\\其他

                                          • C:\\ Program Files文件(x86)的\\实例\\ 1.0 \\包含

                                          • General
                                            • Include Directories:
                                              • C:\Program Files (x86)\Example\1.0\include\shared
                                              • C:\Program Files (x86)\Example\1.0\include\other
                                              • C:\Program Files (x86)\Example\1.0\include

                                              • 附加选项:

                                                • -std = C ++ 11 -pedantic -g3 -Wall -Wextra -O0

                                                • Additional Options:
                                                  • -std=c++11 -g3 -pedantic -Wall -Wextra -O0

                                                  有关默认情况下,所有项目添加命令行选项,请参见:

                                                  For adding command-line options by default for all projects, see:

                                                  • NetBeans settings for GCC

                                                  路径中的任何空间应自动转义。任何反斜杠应自动向前斜杠来代替。

                                                  Any spaces in the path should be automatically escaped. Any backward slashes should be replaced with forward slashes automatically.

                                                  例如,在其他选项中的所有选项文本框看起来是这样的:

                                                  For example, the "All options" textbox in "Additional Options" looks like this:

                                                  -std=c11 -g3 -pedantic -Wall -Wextra -O0 -g -I/C/Program\ Files\ \(x86\)/Example/1.0/include/shared -I/C/Program\ Files\ \(x86\)/Example/1.0/include/other -I/C/Program\ Files\ \(x86\)/Example/1.0/include
                                                  

                                                  如果这不起作用,您可能需要修复路径,添加包括在附加选项手动。例如,将 / C / C:/

                                                  If this does not work, you may have to fix the path and add the includes manually in the additional options. For example, replace /C/ with C:/.

                                                  -std=c11 -g3 -pedantic -Wall -Wextra -O0 -g -IC:/Program\ Files\ \(x86\)/Example/1.0/include/shared -IC:/Program\ Files\ \(x86\)/Example/1.0/include/other -IC:/Program\ Files\ \(x86\)/Example/1.0/include
                                                  

                                                  如果您使用的是Cygwin的制作,如果你尝试清除或者在命令冒号重建项目时,你可能会得到一个 ** *多个目标模式。停止。的错误消息。据多个目标模式?和<一个href=\"http://stackoverflow.com/questions/2401976/very-simple-application-fails-with-multiple-target-patterns-from-eclipse/\">Very简单的应用程序失败,&QUOT;多重目标模式和QUOT;从Eclipse的,制作看到路径和认为这是另一个目标的定义,因此,错误。

                                                  If you are using Cygwin make and if you try to clean or rebuild the project with colons in the command, you may get a *** multiple target patterns. Stop. error message. According to the answers from Multiple target patterns? and Very simple application fails with "multiple target patterns" from Eclipse, "make sees the : in the path and thinks it is another target definition, hence the error."

                                                  解决方法是删除生成的建立 DIST 文件夹每次你建立你的项目之前的时间。然而,这可能是恼人的,所以你可以尝试的MinGW MSYS 制作代替(不要与MinGW的混淆制作,这是<一个href=\"http://netbeans.org/community/releases/68/cpp-setup-instructions.html#mingw\">unsupported).

                                                  The workaround is to delete the generated build and dist folders every time before you build your project. However, this can be annoying, so you could try MinGW MSYS make instead (not to be confused with MinGW make, which is unsupported).

                                                  有关MinGW和MSYS配置说明,请参见:

                                                  For MinGW and MSYS configuration instructions, see:


                                                  • 配置NetBeans IDE以使用C / C ++ / Fortran语言:

                                                  • Configuring the NetBeans IDE for C/C++/Fortran:

                                                  <一个href=\"http://netbeans.org/community/releases/68/cpp-setup-instructions.html#mingw\">http://netbeans.org/community/releases/68/cpp-setup-instructions.html#mingw

                                                  对于MinGW和统一code的工作,你应该安装最新版本的MinGW-W64的。参见:

                                                  For working with MinGW and Unicode, you should install the latest version of MinGW-w64. See:

                                                  • wWinmain, Unicode, and Mingw

                                                  这篇关于如何添加库包含在Windows NetBeans和gcc的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆