I need help with a program I made.
It is a simple client server connection program that works perfectly fine, but as soon as I add #include anything openCV related, the connection consistently fails instantly, as if it didn't even try.
The only related things I found online were this post: Socket doesn't work, when opencv libriary is added
Here is the code, as long as the opencv #include are commented out it works fine, but if they are added at all, it fails to connect always.
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#include <iostream>
#include <winsock2.h>
#include <string>
//#include <opencv2/opencv.hpp>
//#include <opencv2/objdetect.hpp>
//#include <opencv2/imgcodecs.hpp>
//#include <opencv2/highgui/highgui.hpp>
//#include <opencv2/imgproc/imgproc.hpp>
using namespace std;
//using namespace cv;
#pragma comment(lib, "Ws2_32.lib")
int main()
{
WSADATA WSAData;
SOCKET server, client;
SOCKADDR_IN serverAddr, clientAddr;
WSAStartup(MAKEWORD(2, 0), &WSAData);
server = socket(AF_INET, SOCK_STREAM, 0);
serverAddr.sin_addr.s_addr = inet_addr("addresshere");
serverAddr.sin_family = AF_INET;
serverAddr.sin_port = htons(porthere);
bind(server, (SOCKADDR*)&serverAddr, sizeof(serverAddr));
listen(server, 0);
cout << "Listening for incoming connections..." << endl;
int clientAddrSize = sizeof(clientAddr);
client = accept(server, (SOCKADDR*)&clientAddr, &clientAddrSize);
cout << client << "\n";
}