Pelles C forum

C language => Beginner questions => Topic started by: AJ Crayon on February 09, 2020, 05:16:03 PM

Title: Symbol multiply defined, but only appeaars in Project File.
Post by: AJ Crayon on February 09, 2020, 05:16:03 PM
Don't know if this is the correct forum for this question.

I am getting the following multiply defined error with Pelles C version 9.00:
POLINK: error: Symbol '_location' is multiply defined: 'C:\Users\AJ Crayopn\Google Drive\Observing\Double Stars\Measure\output\main.obj' and 'C:\Users\AJ Crayopn\Google Drive\Observing\Double Stars\Measure\output\Proc_Star.obj'.

Neither my source modules nor headers use this symbol.  The only place in the project location appears is in the project file - twice.

I'm sure there is a way to recover from this but have been unsuccessful so far.

Any help would be appreciated.
Title: Re: Symbol multiply defined, but only appeaars in Project File.
Post by: frankie on February 09, 2020, 07:32:45 PM
Hi welcome to PellesC forum.
It isn't possible to understand from where comes the problem with the info you gave us.
What is sure is that the symbol location is defined twice in 2 modules.
You should produce a very reduced sample to publish so we can have a look at it.
In the meantime I suggest you to check in files included in the 2 modules for a symbol location non preceeded by the extern or static qualifiers.
Even a function defined in the header file, not defined as static and inline can produce the same problem.
Title: Re: Symbol multiply defined, but only appeaars in Project File.
Post by: AJ Crayon on February 09, 2020, 09:33:07 PM
Thank you for response.  I have tried to reproduce the error with smaller program - to no avail, but will try again. I will follow-up on your suggestion and see if anything turns up.
Title: Re: Symbol multiply defined, but only appeaars in Project File.
Post by: AJ Crayon on February 09, 2020, 09:49:19 PM
Frankie, I found my problem by following your suggestion about checking includes files.  Found the culprit a
   char location[] = "../pipe.txt";
Changed location to another symbol and get Project build ended successfully.
Title: Re: Symbol multiply defined, but only appeaars in Project File.
Post by: John Z on February 09, 2020, 09:51:00 PM
Something to try is to use the 'Find in Files' feature under Edit, search for the symbol in your project directory and search *.c;*.h.  This will show all occurrences and allow you to easily access them. It also  will show the entire line so look for places where the symbol does not show an 'extern' preface but has a type identifier in front. Of course you'll need to check if using a global symbol locally in which case it would be ok without extern. Example search for 'int a'

main.c (10) int a;
menu.c (20) extern int a;
crypt.c (5) int a;  <- no extern suspect because declared in main.c



Hope this help,
John
Title: Re: Symbol multiply defined, but only appeaars in Project File.
Post by: John Z on February 09, 2020, 09:53:04 PM
Oops simultaneous postings...!
You already got it.

John
Title: Re: Symbol multiply defined, but only appeaars in Project File.
Post by: frankie on February 10, 2020, 01:13:13 AM
Well done!