Your question is not absurd in any case - you are looking for a solution to the problem that we have all encountered for many years - how to achieve compatibility between platforms and code reuse. But maybe there are some points that you need to clarify:
As others have said, C ++ is not the only “agnostic language” - in fact, most of the languages are “OS agnostic” - something that usually is not (and cannot be) OS agnostic — it's a compiler, GUI libraries, etc. Pascal, C ++, Python, C #, Java and many others have SDKs for different OSs, most of which are open source.
If for some reason you are configured for C ++, check out the Embarcedaro C ++ Delphi clone using C ++ instead of Object Pascal.
And IMO you should research Qt: http://doc.qt.nokia.com/latest/index.html - Qt is an excellent "OS agnostic mechanism that includes GUI widgets as well as many other powerful libraries that span almost the entire spectrum of modern computer computing.
Although C ++ is the native language for Qt development, there are many “language bindings” available for programming Qt with other languages. (varying degrees of functionality is supported depending on the implementation of the binding). I understand that binding Object Pascal for Qt using Lazarus - I have not tried it yet, but it sounds very interesting.
Also, one caveat: sharing your GUI with the "guts" of your application, so this OS agnostic can be quite complicated in complex applications - I think that reading from the MVC paradigm is a good place to start.
NTN
source share