Thursday, July 9, 2009

[C programming] I keep getting this error "syntax error: missing ';' before 'type' in my code

My code is as follows:





int socket_fd;


unsigned long server_ip = inet_addr("127.0.0.1");


unsigned short server_port = htons("3247");





int socket_fd;


socket_fd = server_conn(server_ip, client, server_port);





I have all of my semicolons in place, yet it keeps giving me these sorts of errors! It doesn't make sense :(





Does anyone know how to fix this?





Kind regards,





Luke

[C programming] I keep getting this error "syntax error: missing ';' before 'type' in my code
Hi,


One possible reason may be that brackets ({..}) are not in pairs. i.e. u might have forgotten to put closing bracket ( } ).
Reply:change socket_fd to another variable name if possible. try socket_fnd. it may be that socket_fd is used by one of the header files or namespaces. or that it is a type in itself. i don't do much of this sort of work, as i am for now just console, game and non-inet mfc apps.
Reply:You have two of this line:





int socket_fd;





. If that isn't it, please put the rest of the code.

flash cards

No comments:

Post a Comment