LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-07-2004, 02:30 AM   #1
nhan
LQ Newbie
 
Registered: Oct 2003
Posts: 1

Rep: Reputation: 0
Post error: use funtion socket c in Qt Designer?


WHY?
I write program with Qt Designer
file server.ui.h:

#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>

void server:bListening_clicked()
{
int server_sockfd, client_sockfd;
int server_len, client_len;
struct sockaddr_in server_address;
struct sockaddr_in client_address;
server_sockfd = socket(AF_INET, SOCK_STREAM, 0);
server_address.sin_family = AF_INET;
server_address.sin_addr.s_addr = htonl(INADDR_ANY);
server_address.sin_port = htons(9734);
server_len = sizeof(server_address);

bind(server_sockfd,(struct sockaddr*)&server_address, server_len);

listen(server_sockfd, 5);
client_sockfd = accept(server_sockfd,(struct sockaddr *)&client_address, &client_len);
}

#qmake server.pro
#make
Error:
g++ -c -pipe -Wall -W -O2 -march=i386 -mcpu=i686 -g -DGLX_GLXEXT_LEGACY -fno-use-cxa-atexit -fno-exceptions -DQT_NO_DEBUG -I/usr/lib/qt-3.1/mkspecs/default -I. -I/usr/lib/qt-3.1/include -I.ui/ -I.moc/ -o .obj/server.o .ui/server.cpp
In file included from .ui/server.cpp:22:
server.ui.h: In member function `virtual void Server:bListen_clicked()':
server.ui.h:30: no matching function for call to `Server::accept(int&,
sockaddr*, int*)'
/usr/lib/qt-3.1/include/qdialog.h:93: candidates are: virtual void
QDialog::accept()
make: *** [.obj/server.o] Error 1.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to connect to UNIX socket /tmp/.esd/socket error while using grip dr_zayus69 Linux - Software 4 08-23-2005 07:28 PM
Qt Designer + mySql connection error vanquisher Programming 1 08-24-2004 02:21 PM
error coding a funtion in c shams Programming 2 07-27-2004 09:47 PM
C funtion to obtain a process ID Linh Programming 5 06-18-2003 02:37 PM
Numbered Keypad doesn't funtion. l0f33t Linux - Hardware 1 05-25-2003 11:16 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration