I have been told that I can not make a GUI natively using C++ in Xcode on OS X. But then, how are the libraries made to make the GUI? Like qt, openGL, wxWidgets, maybe boost, etc.. I have been told to just use the libraries, but I enjoy making libraries among other things.
Those libraries are written in such a way that they provide a uniform interface to you, but under the hood they have different code for the platforms they support. For instance, to show a window on the screen in windows, you'll need to use the windows API, to do the same on linux, you will need to use the X11 API. If you only want your program to work on OS X I believe Carbon/Cocoa is what you need (though I'm no mac-expert).
Writing such a library yourself would be an enormous task though, not to mention that the many good options out there have been tried and tested by many users and most of them are under continuous development.
Reinventing the wheel can sometimes be educational, but a lot of the times it's just superfluous.