Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9009249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:08:22+00:00 2026-06-16T02:08:22+00:00

While compiling C (not c++) code, I am getting error during link time, that

  • 0

While compiling C (not c++) code, I am getting error during link time, that certain identifiers have been defined at multiple places, but as shown below, the output is very cryptic.

Is there a way to get better messages from gcc, so that I can see which files are the cause of multiple definitions?

/tmp/cc8kgsLE.o:(.rodata+0x0): multiple definition of `PR_SZ'
/tmp/ccDfv6U4.o:(.rodata+0x0): first defined here
/tmp/cc8kgsLE.o:(.rodata+0x8): multiple definition of `PR_SEC_SZ'
/tmp/ccDfv6U4.o:(.rodata+0x8): first defined here
/tmp/cc8kgsLE.o:(.rodata+0x10): multiple definition of `PR_NSEC_SZ'
/tmp/ccDfv6U4.o:(.rodata+0x10): first defined here

collect2: ld returned 1 exit status

UPDATE: Based on responses, i clarify further that
PR_SZ, PR_SEC_SZ, PR_NSEC_SZ are defined in ONE .h file, which is protected by #ifndef, #define and #endif macros..

In terms of compiling, i simply type:

gcc -Wall -I. -file1.c file2.c -o file2

UPDATE:

In addition to responses, i found the below link relevant
global constants without using #define

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:08:23+00:00Added an answer on June 16, 2026 at 2:08 am

    The output displayed doesn’t look cryptic for me, it’s very clear…
    The globals variables (this is bad) PR_SZ, PR_SEC_SZ, PR_NSEC_SZ are defined into more than one .c files

    How do you compile your project ?

    Here the main problem, it’s that .o filename doesn’t match the filename of the .c file.
    So to be able to see a better message you should improve your Makefile or whatever you are using to build your project.

    For information :

    • In .h the prototype of global variables declarations must be prefixed by the keyword : extern
    • In only one .c file the variable should be declare normally
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting this error while compiling C++ code: undefined reference to `__stack_chk_fail' Options already tried:
I am getting the following error while compiling a sample program in Qt 4.5
The following C++ code gives an error while compiling: #include<iostream> using namespace std; class
I get an error, while compiling my C#-code with Visual Studio 2010 on Windows
I am working on VS2010, Crystal Reports. While compiling my code I am getting
While compiling on GCC I get the error: pure-specifier on function-definition , but not
I'm getting the below error while trying to import python module pjsua. I have
I have a problem while compiling my code ( undefined reference to 'yylex' ).
I keep getting an error when Im compiling my code. I believe my logic
This is the output I'm getting while compiling my class under Lubuntu 12.04 32bit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.