Search code examples
c++qtqt-creatorportabilityglibc

inet_pton in QT creator for both windows and linux


i am writing a QT/C++ program, that i don't want to have dependecies on a specific OS (at least keep them to a minimum with some preprocessor directives).

i'm using QT Creator to design my program, which is done mainly on my Linux box, and every now and then, pull the code on the windows machine and attempt to compile it to make sure it still compiles.

to the point now, i need to use the functions inet_pton and inet_ntop, but they seem to be part of the GNU C Library. I looked around, and read that some MS libraries have them as well, though i'm no expert in MS development.

my question, is there an easy way to use these functions in my program? or am i better off checking out their code in glibc, and implementing them myself? or can you recommend some other alternative?

thanks in advance


Solution

  • inet_pton/etc is only available on Vista and above. If you need to run on WinXP you can use WSAStringToAddress().