Solved Multi-platform build
-
I have a C++ project that sometime ago I developed on RedHat Linux. This project was always intended to be multi-platform. However, today I tried to build on Windows 10. Lots of differences to resolve.
My project uses sockets and posix functions. Is there any easier way to manage multi-platform builds?
Right now I'm using _WIN32 and _WIN64 preprocessors for windows, just about everything else, linux and apple builds are standard and do no require pre-processors.
Sockets seems to be one of the biggest hurdles, in the linux code it's quite simple, open, read, write and close, windows isn't so straight forward, instead of write there is a send method and the parameters required are a little different.
-
@SPlatten
Doesn't sound like you're using a lot of Qt in your project?QT has cross platform socket classes that should work/compile with out much issues, when ported from one platform to an other.
If you're using the posix api directly, than you'll have to write a windows equivalent class on your own as well.
Normally you would go through the abstraction layer, Qt provides. -
@SPlatten
Doesn't sound like you're using a lot of Qt in your project?QT has cross platform socket classes that should work/compile with out much issues, when ported from one platform to an other.
If you're using the posix api directly, than you'll have to write a windows equivalent class on your own as well.
Normally you would go through the abstraction layer, Qt provides. -
My project is using a lot of Qt, but my ignorance is to blame, I didn't know Qt had its own classes for sockets.
-
Hi,
You will likely be interested by the Qt network module.
-
Thank you