First of all a disclaimer: it has been 2 years since I last used a shell and I was never good at it, so there might be errors
When you write something like #include <header> you are telling the compiler that you want to include a file that is found in the compiler's
default search path for headers
When you're writing a program you will often make your own headers (or download some), and it's not good to put them in the default search path
So you usually put them in the same directory of the .cpp file. When you want to include such headers you write #include "header.h" The quotes tell the compiler that it should also search for the file in the same directory of the .cpp file
Or you can create a subfolder for headers called "folder" and write #include "folder/header.h". Basically, double quotes means "search for the header also in a directory starting from where the .cpp file is"
But what if your headers where in a very different place? Say they are located in D:\folder\asd\cpp\test\headers. You'd have to write that every time or else the compiler can't find your header and put it into the source, and it's really not smart as a solution. So when you compile a program you can tell the compiler that there are additional search directories in which he has to search for files.
You do that by invoking gcc with a -I argument, something like
g++ -I D:\folder\asd\cpp\test\headers file.cpp -o file |
This allows you to write in the in file.cpp
#include "header.h"
and still make it work even if your header is in that far away place
Now, for libraries it's pretty much the same. You have .lib files (though IIRC MinGW libraries are .a) and your compiler needs to know where they are to link them to the object files
The procedure above can be repeated for libraries, but the switch to use is -L insted of -I
There is one additional step though. For header, all you need to do is writing #include in the source file. Libraries need to be linked when you're compiling a program. You do that with the -l switch (lowercase L) and specifing the name of the library without the extension
Using the example from before it would look something like this
g++ -L D:\folder\asd\cpp\test\libs file.cpp -lConsoleLib -o file |
So, let's say you downloaded those two files. You have a source file in a folder located in D:\cpp and two subfolders (headers and libs). It looks something like this
D:
cpp
headers
Console.h
libs
Console.lib
file.cpp
|
To compile this you would invoke
g++ -L D:\cpp\libs -I D:\cpp\headers file.cpp -lConsoleLib -o file |
By the way, the default search path of MinGW is MinGW\include for headers and MinGW\lib for libraries
And now the reason why all of this is useless to you: IDEs take care of invoking the compiler using arguments specified in their settings. So you have to find the place where you can tell netbeans that he has to add the directories where you put the files to its search directories and also find the place where to tell him that he has to link a library to the .cpp file
I hope this is at least a bit useful. It took me quite some time to figure out all of this by myself with the help of google, hopefully you can have it easier