Not including include files [message #212470] |
Mon, 24 March 2008 14:33 |
Eclipse User |
|
|
|
Originally posted by: jamesrome.gmail.com
I am trying to get sockets working in Windows in the MinGW environment.
The C preprocessor seems to be screwing up somehow.
The start of my code looks like:
#define GPC_WIN
#include <stdio.h>
#include <stdlib.h>
#ifdef GPC_WIN
#define WINVER 0x0501 //XP or greater
#include <process.h>
#include <winsock2.h>
#endif // end ifdef GPC_WIN
#ifdef GPC_UNX
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <errno.h>
#include <netdb.h>
#endif
/*
*
*/
int main(int argc, char** argv) {
FILE * fp;
int sd, ch, i, n, m;
const struct sockaddr_in addr;
struct in_addr inputaddress;
char * portstr;
int port;
unsigned char buffer[256];
unsigned char eofBuffer[] = { '!', '!', '!', '!' };
int end = 0;
char *my_env[528];
char * filename;
pid_t my_id, f_id;
int launch_java = 1;
#ifdef GPC_WIN
WORD wVersionRequested;
WSADATA wsaData;// winsock data struct
int wsaerr; // winsock data struct
sockaddr_in service;
#endif
sockaddr_in is in winsock2.h, yet I get compilers errors saying that
sock_addr_in is undeclared when I try to use it here. Why isn't it reading
my include files? And yes, I have the path to mingw\include in my compile
properties.
And also, Before adding this code, things compiled OK, I got a, object
file in the dist directory, but I never got an executable produced. There
were no error messages either. Is there a trick to getting the executable
created?
Finally, mingw has a libws2_32.a file in its library section, but I cannot
get the linker to find this. It will accept ws2_32.lib from the
VisualStudio directories, but I would rather allow users to use free
tools. So how do I include the .a file into my project?
Thanks for the help,
Jim
|
|
|
|
Re: Not including include files [message #212500 is a reply to message #212480] |
Mon, 24 March 2008 23:42 |
Eclipse User |
|
|
|
Originally posted by: jamesrome.gmail.com
On the plain vanilla Microsoft version, I did the preprocessor step only
and get the error:
Severity and Description Path Resource Location Creation Time Id
Invalid project path: Duplicate path
entries. sockettest pathentry 1206373077710 930
What does this mean, and how to fix it?
Nothing seems to work.
|
|
|
Powered by
FUDForum. Page generated in 0.03102 seconds