[ create a new paste ] login | about

Link: http://codepad.org/5p3nieyb    [ raw code | output | fork ]

C, pasted on Apr 17:
#include "common.h"

typedef struct nodeData_t nodeData;

int listenerThread(struct nodeData* nodeData) {
	SOCKET listenSocket;
	if(!createSocket(listenSocket))
	{
		WSACleanup();
		exit(-1);
	}
	// bind socket to port
	if(!bindSocket(listenSocket,nodeData->/* this is where it doesnt compile */)){
		closesocket(listenSocket);
		WSACleanup();
		exit(-1);
	}
}


void main(int argc,char* argv[]) {

	/* struct to hold the node's neighbors */
	struct neighbor {
		char *ip;
		unsigned short port;	
		int cost;
	};

	/*	struct to hold the node's data. 
		the threads are going to change some of these fields constantly */
	struct nodeData {
		int procid;
		unsigned short localport;
		DWORD LIFETIME;
		DWORD HELLOTIMEOUT;
		DWORD MAXTIME;
	} nodeData;


	free(neighbors);
	exit(0);
}


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Line 19: error: common.h: No such file or directory
Line 6: warning: 'struct nodeData' declared inside parameter list
Line 6: warning: its scope is only this definition or declaration, which is probably not what you want
In function 'listenerThread':
Line 7: error: 'SOCKET' undeclared (first use in this function)
Line 7: error: (Each undeclared identifier is reported only once
Line 7: error: for each function it appears in.)
Line 7: error: expected ';' before 'listenSocket'
Line 8: error: 'listenSocket' undeclared (first use in this function)
Line 11: warning: incompatible implicit declaration of built-in function 'exit'
Line 14: error: expected identifier before ')' token
Line 17: warning: incompatible implicit declaration of built-in function 'exit'
In function 'main':
Line 36: error: expected specifier-qualifier-list before 'DWORD'
Line 42: error: 'neighbors' undeclared (first use in this function)
Line 43: warning: incompatible implicit declaration of built-in function 'exit'
Line 22: warning: return type of 'main' is not 'int'


Create a new paste based on this one


Comments: