strange multiple definition of `login_user_login'

Discussion in 'C Programming' started by Robert Mens, Oct 25, 2003.

  1. Robert Mens

    Robert Mens Guest

    Hi,

    My compiler/linker gives me the strangest error:

    process.o(.text+0x0): In function `login_user_login':
    : multiple definition of `login_user_login'
    login.o(.text+0x0): first defined here
    collect2: ld returned 1 exit status
    make: *** [imserver] Error 1

    I only have this function defined once:

    this is my login.c file
    -----------------------------------------------------------------
    /*
    ** login.c - handles the login requests from servers
    */

    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include "mysql.h"

    void login_user_login(char * username, char * password)
    {
    if (mysql_user_login(username, password) == 1)
    {
    printf("Access denied for user %s\n", username);
    }else{
    printf("User %s logged in\n", username);
    mysql_user_setstatus(username, "online");
    }
    }
    -----------------------------------------------------------------

    this is my login.h file for including from other source files:

    void login_user_login(char * username, char * password);

    I did this this way in my project and never encountered that error...
    Also, it only happens when i do a make clean; make, thus when the whole
    source gets recompiled instead of just login.o

    If i do a make "clean; make" and then adjust the login_user_login in login.c
    to something different en then "make" the program works fine!?!?

    Anyone knows the solution?

    Thanks in advance,

    Robert

    --
    ln[dot]tenalp[at]snem_trebor
    read reversed and fill dot&at for email
     
    Robert Mens, Oct 25, 2003
    #1
    1. Advertising

  2. Robert Mens

    nobody Guest

    [OT] Re: strange multiple definition of `login_user_login'

    "Robert Mens" <> wrote in message
    news:bnem0t$fet$...
    > Hi,
    >
    > My compiler/linker gives me the strangest error:
    >
    > process.o(.text+0x0): In function `login_user_login':
    > : multiple definition of `login_user_login'
    > login.o(.text+0x0): first defined here
    > collect2: ld returned 1 exit status
    > make: *** [imserver] Error 1
    >
    > I only have this function defined once:
    >
    > this is my login.c file
    > -----------------------------------------------------------------
    > /*
    > ** login.c - handles the login requests from servers
    > */
    >
    > #include <stdio.h>
    > #include <string.h>
    > #include <stdlib.h>
    > #include "mysql.h"
    >
    > void login_user_login(char * username, char * password)
    > {
    > if (mysql_user_login(username, password) == 1)
    > {
    > printf("Access denied for user %s\n", username);
    > }else{
    > printf("User %s logged in\n", username);
    > mysql_user_setstatus(username, "online");
    > }
    > }
    > -----------------------------------------------------------------
    >
    > this is my login.h file for including from other source files:
    >
    > void login_user_login(char * username, char * password);
    >
    > I did this this way in my project and never encountered that error...
    > Also, it only happens when i do a make clean; make, thus when the whole
    > source gets recompiled instead of just login.o
    >
    > If i do a make "clean; make" and then adjust the login_user_login in

    login.c
    > to something different en then "make" the program works fine!?!?
    >

    I would bet all my money on linker. Though you didn't post arguments passed
    to compiler, from diagnostics it's clear you are linking 2 files: process.o
    and
    login.o. You didn't supply source file which resulted in process.o either.
    Likely
    that source file contains definition of problematic function (either
    "directly",
    or "indirectly" /via #include "login.c"/ - check for typo), or another
    object
    with the same name.
     
    nobody, Oct 26, 2003
    #2
    1. Advertising

  3. Robert Mens

    Robert Mens Guest

    Re: [OT] Re: strange multiple definition of `login_user_login'

    nobody wrote:

    > "Robert Mens" <> wrote in message
    > news:bnem0t$fet$...
    >> Hi,
    >>
    >> My compiler/linker gives me the strangest error:
    >>
    >> process.o(.text+0x0): In function `login_user_login':
    >> : multiple definition of `login_user_login'
    >> login.o(.text+0x0): first defined here
    >> collect2: ld returned 1 exit status
    >> make: *** [imserver] Error 1
    >>
    >> I only have this function defined once:
    >>
    >> this is my login.c file
    >> -----------------------------------------------------------------
    >> /*
    >> ** login.c - handles the login requests from servers
    >> */
    >>
    >> #include <stdio.h>
    >> #include <string.h>
    >> #include <stdlib.h>
    >> #include "mysql.h"
    >>
    >> void login_user_login(char * username, char * password)
    >> {
    >> if (mysql_user_login(username, password) == 1)
    >> {
    >> printf("Access denied for user %s\n", username);
    >> }else{
    >> printf("User %s logged in\n", username);
    >> mysql_user_setstatus(username, "online");
    >> }
    >> }
    >> -----------------------------------------------------------------
    >>
    >> this is my login.h file for including from other source files:
    >>
    >> void login_user_login(char * username, char * password);
    >>
    >> I did this this way in my project and never encountered that error...
    >> Also, it only happens when i do a make clean; make, thus when the whole
    >> source gets recompiled instead of just login.o
    >>
    >> If i do a make "clean; make" and then adjust the login_user_login in

    > login.c
    >> to something different en then "make" the program works fine!?!?
    >>

    > I would bet all my money on linker. Though you didn't post arguments
    > passed to compiler, from diagnostics it's clear you are linking 2 files:
    > process.o and
    > login.o. You didn't supply source file which resulted in process.o either.
    > Likely
    > that source file contains definition of problematic function (either
    > "directly",
    > or "indirectly" /via #include "login.c"/ - check for typo), or another
    > object
    > with the same name.


    Made a typo
    login.c instead of login.h


    --
    ln[dot]tenalp[at]snem_trebor
    read reversed and fill dot&at for email
     
    Robert Mens, Oct 26, 2003
    #3
  4. Robert Mens

    Nick Austin Guest

    On Sat, 25 Oct 2003 22:21:31 +0200, Robert Mens
    <> wrote:

    >Hi,
    >
    >My compiler/linker gives me the strangest error:
    >
    >process.o(.text+0x0): In function `login_user_login':
    >: multiple definition of `login_user_login'
    >login.o(.text+0x0): first defined here
    >collect2: ld returned 1 exit status
    >make: *** [imserver] Error 1


    My guess would be that there is a definition for login_user_login
    inside process.c

    Nick.
     
    Nick Austin, Oct 26, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jianli Shen
    Replies:
    1
    Views:
    642
    Victor Bazarov
    Mar 13, 2005
  2. Ark
    Replies:
    1
    Views:
    451
    Chris Torek
    Aug 7, 2004
  3. Jon Slaughter
    Replies:
    4
    Views:
    471
    Jon Slaughter
    Oct 26, 2005
  4. Replies:
    11
    Views:
    1,274
    Ian Collins
    Aug 5, 2006
  5. Pierre Yves
    Replies:
    2
    Views:
    524
    Pierre Yves
    Jan 10, 2008
Loading...

Share This Page