I am working on a machine vision project that Analyses live video and sends data to another server. I have the OpenCV portion working on it's own and I have a socket example working on it's own. When I went ahead to integrate the two, the initial socket call returns -1.
I have narrowed it down to the following example.
I can compile it on it's own and it works fine, Socket opened as expected. If I link the OpenCV libs, it returns a -1 and cannot open the socket.
I have seen this issue in G++ 5.2.0 on OSX as well as Cygwin. The OSX10.10 built in compiler does however work without issue.
Any help would be appreciated.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main(int argc, char **argv)
{
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
cerr << "Error opening socket" << endl;
else
cout << "Socket opened" << endl;
}
I am using CMAKE to find the packages and link them if that helps.
Aucun commentaire:
Enregistrer un commentaire