DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

How I can check that the system that I build is for linux or not?

I asked on how I can make a multi-platform application especially how I can make the way that a socket is generated different.

I am making a basic socker application that communicates via a socket to Http protocol on top of an SSL.

The example that I made is:

#define _WINSOCK_DEPRECATED_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include <winsock2.h>
#include <ws2tcpip.h>
#include <shlwapi.h>

// Need to link with Ws2_32.lib, Mswsock.lib, and Advapi32.lib
#pragma comment (lib, "Ws2_32.lib")
//#pragma
…

I would love some answer on that.

Top comments (2)

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
joelbonetr profile image
JoelBonetR πŸ₯‡

We've the #help tag for this purposes. The post is OK.

To the OP, check this:

73

I am writing a cross platform program. I want this one program to run under both Windows and Linux, so I have two different code segments for the two platforms. If the OS is Windows, I want the first code segment to run; if it's Linux, then I want the…

It may help you.