From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14746 invoked by alias); 30 Apr 2006 14:18:42 -0000 Received: (qmail 14738 invoked by uid 22791); 30 Apr 2006 14:18:42 -0000 X-Spam-Check-By: sourceware.org Received: from chaplin.rz.uni-frankfurt.de (HELO chaplin.rz.uni-frankfurt.de) (141.2.22.74) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 30 Apr 2006 14:18:37 +0000 Received: from jimknopf.rz.uni-frankfurt.de ([141.2.22.56]) by chaplin.rz.uni-frankfurt.de with esmtps (TLSv1:AES256-SHA:256) (Exim 4.50) id 1FaCkn-00022V-1T; Sun, 30 Apr 2006 16:18:29 +0200 Received: from dumbo.ghl40.whgl.uni-frankfurt.de ([141.2.119.130]) by jimknopf.rz.uni-frankfurt.de with esmtp (Exim 4.50) id 1FaCkk-0008OG-Rf; Sun, 30 Apr 2006 16:18:27 +0200 Message-ID: <4454C73A.3080508@cs.uni-frankfurt.de> Date: Sun, 30 Apr 2006 14:18:00 -0000 From: Sven Eschenberg User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) MIME-Version: 1.0 To: Edward Hotchkiss CC: gcc-help@gcc.gnu.org Subject: Re: mysql.h issue References: <000901c66c60$4b1a8fd0$0202a8c0@valero> In-Reply-To: <000901c66c60$4b1a8fd0$0202a8c0@valero> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-04/txt/msg00295.txt.bz2 I assume, that: #include should read #include Since it is in a subdir ... Regards -Sven Edward Hotchkiss wrote: >When I "make -f MAKE" using the following make file, I Get this error: > >thing.c:28:19: error: mysql.h: No such file or directory >thing.c:49: error: syntax error before '*' token >thing.c:49: warning: data definition has no type or storage class >thing.c: In function 'mysql_connect': >thing.c:134: warning: assignment makes pointer from integer without a >cast >make: *** [thing.o] Error 1 > >When I run "locate mysql.h" >It returns /usr/include/mysql/mysql.h > >Any ideas why I get this error? > >- edward > > > ># MAKE >CC = gcc >INCLUDES = -P/usr/include/mysql/mysql.h >LIBS = -L/usr/local/lib/mysql -lmysqlclient > >all: thing > >thing: thing.o > $(CC) -o thing thing.o $(LIBS) > >clean: > rm -f thing.o > > > >/* >thing.c >- WebServer Monitor w/ MySQL logging >- 04/29/06 >------------------------------------ >*/ > >#include >#include >#include >#include >#include >#include >#include >#include >#include >#include >#include >#include >#include >#include > >// default port to start with >#define DEF_START_PORT 1 > >// default port to end with >#define DEF_STOP_PORT 65000 > >// Program Version >#define VERSION 0 > >// Author >#define AUTHOR "e2" > >// MySQL Connection data >#define MYSQL_HOST "localhost" >#define MYSQL_USER "root" >#define MYSQL_PASS "5gtswedfgbc06" >#define MYSQL_DATABASE "thing" > >// MySQL Connection Handle >MYSQL *conn; > >struct sockaddr_in addr; >struct hostent *rh; >struct servent *rp; > >int sock, i; > >// Pointers to the start and stop ports >int start_ptr, stop_ptr; > >// Show the user proper program usage >int Usage(char *ARG); > >// Connection/Port >int CONNECTION(int port); > >// Iterate through ports, check ports for validity >int main(int argc, char *argv[]) >{ > > if (argc != 4) > Usage(argv[0]); > start_ptr = atoi(argv[2]); > stop_ptr = atoi(argv[3]); > if (strcmp(argv[2],"-")==0 && strcmp(argv[3],"-")==0){ > start_ptr = DEF_START_PORT; > stop_ptr = DEF_STOP_PORT; > } > > if ( start_ptr > stop_ptr){ > fprintf(stderr,"Error, Can't Be Greater Than >.-\n"); > Usage(argv[0]); > exit(1); > } > // Host does not exist > if ((rh=gethostbyname(argv[1])) == NULL) { > fprintf(stderr,"Can't Resolve Host %s .-\n",argv[1]); > Usage(argv[0]); > exit(1); > } > // Scan title > printf("Scanning Host %s From %d TCP Port To %d .-\n", argv[1], >start_ptr, stop_ptr); > // Iterate through ports > for (i=start_ptr; i <= stop_ptr; i++) > { > if (CONNECTION(i)==0) > { > rp = getservbyport(htons(i), "tcp"); > printf("Port %d Is Open !!! <%s> >ServicE.-\n",i,(rp == NULL)?"Uknown":rp->s_name); > } > close(sock); > } >// Exit >return 0; >} > >// Try and connect to a port >int CONNECTION(int port) >{ > if ((sock=socket(AF_INET, SOCK_STREAM, 0)) == -1){ > perror("SockeT"); > exit(1); > } > addr.sin_family = AF_INET; > addr.sin_port = htons(port); > addr.sin_addr = *((struct in_addr *)rh->h_addr); > if ((connect(sock,(struct sockaddr *) &addr, sizeof(addr))) == >0) > // Port is open > return 0; > else > // Port is close > return 1; >} > >// Invalid usage, display usage information >int Usage(char *ARG) >{ > fprintf(stderr,"\nUsage: %s Port>\n\n", ARG); > exit(1); >} > >// Connect to a MySQL Server >int mysql_connect(int argc, char *argv[]) >{ > conn = mysql_init (NULL); > mysql_real_connect ( > conn, > // Connect data > MYSQL_HOST, > MYSQL_USER, > MYSQL_PASS, > MYSQL_DATABASE, > // Port > 0, > // Socket, use default > NULL, > // Flags, None > 0 > ); >}; > >// Close connection to a mysql server >int mysql_disconnect() >{ > mysql_close(conn); >} > > > > >