All the code that does stuff is in a "library" somewhere -- code that has already been compiled and ready to link to your program -- either as part of your final executable/binary or as a dynamic link file (".so" on OSX).
Functions and stuff that comes with C++ (things like cout, printf(), etc) is automatically linked for you. Stuff that does not come with it (like NCurses functions: wprintf(), etc) is not. You need to tell the compiler/linker where to find the library file so that it can be linked to the code you wrote.