Thread: Using multiple source files: Multiple Declarations & Wrong line numbers

  1. #1

    [SOLVED] Using multiple source files: Multiple Declarations & Wrong line numbers

    [EDIT] This problem was solved, i had a file that i kept saving with the wrong name, so it never really updated. Thanks anyway!
    [/EDIT]

    Wow, this is really weird. Somehow it thinks I am redefining a function where i am not, and even where a function isn't even being defined. Here are the errors:
    Code:
    g++ -pthread nemoserv.o nemoirc.o logger.o ircfunc.o sockfunc.o -o nemoserv
    nemoirc.o: In function `putServ(char *, int)':
    /home/ethereal/c++/nemoserv/nemoirc.h:83: multiple definition of `putServ(char *, int)'
    nemoserv.o:/home/ethereal/c++/nemoserv/logger.h:40: first defined here
    nemoirc.o: In function `putRawServ(char *, int)':
    /home/ethereal/c++/nemoserv/ircfunc.h:31: multiple definition of `putRawServ(char *, int)'
    nemoserv.o:/home/ethereal/c++/nemoserv/ircfunc.h:31: first defined here
    ircfunc.o: In function `putServ(char *, int)':
    /home/ethereal/c++/nemoserv/ircfunc.cpp:19: multiple definition of `putServ(char *, int)'
    nemoserv.o:/home/ethereal/c++/nemoserv/logger.h:40: first defined here
    ircfunc.o: In function `putRawServ(char *, int)':
    /home/ethereal/c++/nemoserv/ircfunc.cpp:32: multiple definition of `putRawServ(char *, int)'
    nemoserv.o:/home/ethereal/c++/nemoserv/ircfunc.h:31: first defined here
    collect2: ld returned 1 exit status
    make: *** [nemoserv] Error 1
    [NOTE]
    The attached file is only .zip for upload reasons, it is not actually a .zip file. It is a .tar.gz or a .tgz file.
    [/NOTE]
    Last edited by Inquirer; 04-30-2003 at 04:43 PM.
    Compilers:
    GCC on Red Hat 8.1 (Primary)
    GCC on Mac OS X 10.2.4 (Secondary)

    Others:
    MinGW on XP

  2. #2
    Oh. I'd been experimenting with moving every single declaration from the .h and leaving only the prototypes, so i probably ended up fixing both problems without realizing it. Thanks for the tip.

    ~EtherealFlaim
    Compilers:
    GCC on Red Hat 8.1 (Primary)
    GCC on Mac OS X 10.2.4 (Secondary)

    Others:
    MinGW on XP

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Logical errors with seach function
    By Taka in forum C Programming
    Replies: 4
    Last Post: 09-18-2006, 05:20 AM
  2. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  3. Major glitch losing source files with MSVC++ and WinXP
    By JasonD in forum C++ Programming
    Replies: 10
    Last Post: 08-14-2003, 12:15 PM
  4. using a class in multiple source files???
    By Crossbow in forum C++ Programming
    Replies: 9
    Last Post: 06-18-2002, 07:42 PM
  5. Line Numbers in VI and/or Visual C++ :: C++
    By kuphryn in forum C++ Programming
    Replies: 2
    Last Post: 02-10-2002, 10:54 PM