Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > strange multiple definition of `login_user_login'

Reply
Thread Tools

strange multiple definition of `login_user_login'

 
 
Robert Mens
Guest
Posts: n/a
 
      10-25-2003
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
 
Reply With Quote
 
 
 
 
nobody
Guest
Posts: n/a
 
      10-25-2003
"Robert Mens" <(E-Mail Removed)> wrote in message
news:bnem0t$fet$(E-Mail Removed)...
> 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.


 
Reply With Quote
 
 
 
 
Robert Mens
Guest
Posts: n/a
 
      10-25-2003
nobody wrote:

> "Robert Mens" <(E-Mail Removed)> wrote in message
> news:bnem0t$fet$(E-Mail Removed)...
>> 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
 
Reply With Quote
 
Nick Austin
Guest
Posts: n/a
 
      10-26-2003
On Sat, 25 Oct 2003 22:21:31 +0200, Robert Mens
<(E-Mail Removed)> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run-time template list definition / Run-time variable type definition Pierre Yves C++ 2 01-10-2008 02:52 PM
How to avoid multiple definition of a variable by multiple inclusion of a header file lars.uffmann@rwth-aachen.de C++ 11 08-05-2006 10:24 PM
Automagic determination of definition based on definition location. Jon Slaughter C++ 4 10-26-2005 05:00 PM
can a class definition inside another class's definition Jianli Shen C++ 1 03-13-2005 06:02 PM
help?: incomplete definition with complete definition in scope Ark C Programming 1 08-07-2004 04:21 PM



Advertisments