OCCRA
Go to Post Step 1: Get Drill Step 2: Insert 1/2"-1" bit into drill Step 3: Drill Those Speed Holes! - Adam Richards [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-01-2005, 09:41 PM
cloudago cloudago is offline
Registered User
#0662
 
Join Date: Jan 2005
Location: Colorado Springs
Posts: 3
cloudago is an unknown quantity at this point
Send a message via AIM to cloudago
MPLink Error

We ran into a problem when we tried defining unsigned chars in a header file and running into a Linker error that claimed that a variable had multiple definitions.

This is what we have in the header file which causes the error:
long int KP_P = 5;

This is the error given by the Linker:
Error - symbol 'KP_P' has multiple definitions.

This source code does not cause an error:
#define KP_P (5)

Declaring the variable as a long int in the *.c file does not cause any errors, it is only in the header file that it causes the error.

Has anyone run into this error or is it a bug in the Linker?
  #2   Spotlight this post!  
Unread 02-01-2005, 10:00 PM
probizzle's Avatar
probizzle probizzle is offline
Registered User
AKA: Prabhas Pokharel
#0639 (Code Red)
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2003
Location: Ithaca
Posts: 78
probizzle will become famous soon enoughprobizzle will become famous soon enough
Send a message via AIM to probizzle
Re: MPLink Error

It is not a bug in the linker.

When you declare a long int in the header file, every time a .c includes this header file, space will be allocated for KP_P. Even if you have the #ifndef __header_file_name_h_ #define __header_file_name_h_ at the top of the file.

Here is the solution:

declare lont int KP_P in a .c file.
However, also
add
Quote:
extern long int KP_P;
in the header file.
Now, if you include this header file, you should be able to use KP_P.

Another comment:
the define doesn't show an error, because it is essentially a copy paste operation, and the compiler is smart enough to figure it out.
__________________
Code Red Team 639 Winners of the 2005 FingerLakes Regional with 191 and 494.
--
http://pset.deu83.com << my baby
http://www.setgame.com/set/ << it's mother
  #3   Spotlight this post!  
Unread 02-01-2005, 10:00 PM
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,443
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: MPLink Error

This is not a bug. KP_P is defined somewhere else. Either fiond out where or change the variable name.
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MPLab build error Derek t Programming 7 01-17-2005 08:33 AM
error - Invalid 18f8520 header file! vtrehan Programming 2 11-16-2004 07:31 AM
Confusing Compiler Error UrsaMNet Programming 2 10-28-2004 01:32 PM
PHP and Wiki Error Venkatesh Website Design/Showcase 2 07-24-2004 02:51 PM
Linker Error Max Lobovsky Programming 4 05-27-2004 07:16 PM


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi