How to add a library include path for NetBeans and gcc on Windows?
Using:
- NetBeans 7.1.2
- MinGW (
mingw-get-inst-20120426.exe) - gcc 4.7.0
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For example, you want to add the directories in
C:\Program Files (x86)\Example\1.0\include\as the include paths.First, set up code assistance:
C:\Program Files (x86)\Example\1.0\include\sharedC:\Program Files (x86)\Example\1.0\include\otherC:\Program Files (x86)\Example\1.0\includeC:\MinGW\lib\gcc\mingw32\4.7.0\includeC:\MinGW\includeC:\MinGW\lib\gcc\mingw32\4.7.0\include-fixedC:\Program Files (x86)\Example\1.0\include\sharedC:\Program Files (x86)\Example\1.0\include\otherC:\Program Files (x86)\Example\1.0\includeC:\MinGW\lib\gcc\mingw32\4.7.0\include\c++C:\MinGW\lib\gcc\mingw32\4.7.0\include\c++\mingw32C:\MinGW\lib\gcc\mingw32\4.7.0\include\c++\backwardC:\MinGW\lib\gcc\mingw32\4.7.0\includeC:\MinGW\includeC:\MinGW\lib\gcc\mingw32\4.7.0\include-fixedThe
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:For instructions on automatic code assistance for existing sources, see:
C/C++ Projects Quick Start Tutorial:
http://netbeans.org/kb/docs/cnd/quickstart.html#makefileprojects
How to Configure Code Assistance When Creating a Project from Existing Code:
http://netbeans.org/kb/docs/cnd/configuring-code-assistance.html
Now, configure the project options:
C:\Program Files (x86)\Example\1.0\include\sharedC:\Program Files (x86)\Example\1.0\include\otherC:\Program Files (x86)\Example\1.0\include-std=c11 -g3 -pedantic -Wall -Wextra -O0C:\Program Files (x86)\Example\1.0\include\sharedC:\Program Files (x86)\Example\1.0\include\otherC:\Program Files (x86)\Example\1.0\include-std=c++11 -g3 -pedantic -Wall -Wextra -O0For adding command-line options by default for all projects, see:
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:
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/withC:/.If you are using Cygwin
makeand 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, “makesees the:in the path and thinks it is another target definition, hence the error.”The workaround is to delete the generated
buildanddistfolders every time before you build your project. However, this can be annoying, so you could try MinGW MSYSmakeinstead (not to be confused with MinGWmake, which is unsupported).For MinGW and MSYS configuration instructions, see:
Configuring the NetBeans IDE for C/C++/Fortran:
http://netbeans.org/community/releases/68/cpp-setup-instructions.html#mingw
For working with MinGW and Unicode, you should install the latest version of MinGW-w64. See: