Results 1 to 2 of 2

Thread: Error: Using Multiple files

  1. #1
    Join Date
    Oct 2007
    Location
    Caracas - Venezuela
    Posts
    15
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Error: Using Multiple files

    Hi!!

    I have these files and their headers:

    1. main.cpp:
    #include <QApplication>
    #include "window.h"
    #include "register.h"

    2. window.h
    #ifndef WINDOW_H
    #define WINDOW_H
    #include <QWidget>

    3. window.cpp
    #include <QtGui>
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <cstdlib>

    #include "client.c"
    #include "register.h"
    #include "window.h"

    4. register.h
    #ifndef PRINCIPAL_H
    #define PRINCIPAL_H

    #include <QWidget>

    5. register.cpp

    #include <QtGui>
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <cstdlib>

    #include "client.c"
    #include "principal.h"
    #include "window.h"

    6. client.c

    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <netdb.h>
    #include <stdlib.h>
    #include <string.h>
    #include <ifaddrs.h>
    #include <arpa/inet.h>
    #include <net/if.h>
    #include <errno.h>

    When I compile it, I get an error, the compiler complains that these
    names are all duplicates. How can I get it to realize that these are
    coming from the same header and refer to the same things instead of
    making two different copies?

    In register.cpp and window.cpp I need to use procedures of client.c

    Thanks!!!!!

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Error: Using Multiple files

    Make a separate header file, client.h. You can't include a source file to other multiple source files.
    J-P Nurmi

Similar Threads

  1. Replies: 5
    Last Post: 22nd September 2006, 09:04
  2. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 06:23
  3. [Win32/VC++ 8.0] Strange problems with qrc_*.cpp files
    By mloskot in forum Installation and Deployment
    Replies: 6
    Last Post: 6th March 2006, 11:28
  4. Replies: 25
    Last Post: 15th January 2006, 01:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.