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

  • SEARCH
  • Home
  • 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 7754871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:25:22+00:00 2026-06-01T12:25:22+00:00

I’m working on a project with multiple files and I need logging in each

  • 0

I’m working on a project with multiple files and I need logging in each of it.

In order to compile a file I need the following:

/* Define the stock front-end process identity, so that it links when using
 * fe.N, fe.simple, etc. */
PANTHEIOS_EXTERN_C const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[] = PSTR("fileX.cpp");

Let’s say, I have log1.cpp and log2.cpp and log.h common to both files. These files get compiled to log1.o and log2.o. That works just fine.

Now, when I link these two files into one executable, I get the following error:

log2.o:(.rodata+0x11): multiple definition of `PANTHEIOS_FE_PROCESS_IDENTITY'
log1.o:(.rodata+0x45): first defined here

Now the problem is, that PANTHEIOS_FE_PROCESS_IDENTITY needs to be defined in both file1.cpp and file2.cpp in order to compile.

How do I need to change my code in order to be able to link it into an executable?

Here are the files used:
log1.cpp:

#include "log.h"

const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[] = PSTR("log1.cpp");

int main()
{
  PANTHEIOS_TRACE_NOTICE(PSTR("a string at NOTICE level"));
  return 0;
}

log2.cpp:

#include "log.h"
const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[] = PSTR("log1.cpp");

log.h:

#ifndef LOG_H
#define LOG_H

/* Pantheios Header Files */
#include <pantheios/pantheios.h>                // Pantheios C main header
#ifndef STLSOFT_CF_SUPPORTS_VARIADIC_MACROS
# error This example uses the Tracing API, which requires that the compiler support variadic macros
#endif /* !STLSOFT_CF_SUPPORTS_VARIADIC_MACROS */
#ifdef STLSOFT_CF_FUNCTION_SYMBOL_SUPPORT
# include <string>
# define PANTHEIOS_TRACE_PREFIX     \
    (   std::basic_string< PANTHEIOS_NS_QUAL(pan_char_t)>(__FILE__ " " PANTHEIOS_STRINGIZE(__LINE__) ": ") + \
        __FUNCTION__ + \
        "(): " \
    ).c_str()
#endif /* STLSOFT_CF_FUNCTION_SYMBOL_SUPPORT */
#include <pantheios/trace.h>                    // Pantheios Trace API
#include <pantheios/pantheios.hpp>              // Pantheios C++ main header

/* Standard C/C++ Header Files */
#include <exception>                            // for std::exception
#include <new>                                  // for std::bad_alloc
#include <string>                               // for std::string
#include <stdlib.h>                             // for exit codes

#ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
# if defined(STLSOFT_COMPILER_IS_MSVC)
#  pragma warning(disable : 4702)
# endif /* compiler */
#endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */

#define PSTR(x)         PANTHEIOS_LITERAL_STRING(x)

#include "pantheios/frontends/fe.simple.h" //for pantheios_fe_simple_setSeverityCeiling(level);

#endif //LOG_H

And the output of make:

g++ log1.cpp -c -I../pantheios-1.0.1-beta213/include -I../stlsoft-1.9.112/include
g++ log2.cpp -c -I../pantheios-1.0.1-beta213/include -I../stlsoft-1.9.112/include
g++ -o log log1.o log2.o -L../pantheios-1.0.1-beta213/lib \
        -lpantheios.1.core.gcc44\
        -lpantheios.1.be.fprintf.gcc44 -lpantheios.1.bec.fprintf.gcc44\
        -lpantheios.1.fe.simple.gcc44 -lpantheios.1.util.gcc44
log2.o:(.rodata+0x0): multiple definition of `PANTHEIOS_FE_PROCESS_IDENTITY'
log1.o:(.rodata+0x1): first defined here
/usr/bin/ld: Warning: size of symbol `PANTHEIOS_FE_PROCESS_IDENTITY' changed from 14 in log1.o to 9 in log2.o
collect2: ld returned 1 exit status

Edit: in pantheios-1.0.1-beta213/include/pantheios/frontends/stock.h:120 ‘PANTHEIOS_FE_PROCESS_IDENTITY’ is declared as extern, so I cannot redefine it as static.

  • 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-01T12:25:23+00:00Added an answer on June 1, 2026 at 12:25 pm

    I do apologize if my question/answer sounds odd: but why do want to define PANTHEIOS_FE_PROCESS_IDENTITY in each .cpp file? The PANTHEIOS_FE_PROCESS_IDENTITY needs to be defined only once per logging process, and is printed to the log statement at the start of each line. E.g. from my own pantheios-based logger project:

    [l.SPP.6408, 4/7/2012 6:28:44.702 PM; Notice]: .\Log.cpp(168): CLogApp::InitInstance: STARTING LOGGING

    I only have 1 PANTHEIOS_FE_PROCESS_IDENTITY defined – in Log.cpp (not the .h). as follows and is applicable for not only the LOG project but other projects in my solution (VS2005) that need access to the logger:

    PANTHEIOS_EXTERN_C const char PANTHEIOS_FE_PROCESS_IDENTITY[] = "l.SPP";

    You will get the filename+line-number from where the log statement is being printed out if you use PANTHEIOS_TRACE_NOTICE – see the example I posted above (in bold).

    I suggest that you determine if PANTHEIOS_FE_PROCESS_IDENTITY really needs to be defined per-cpp file or per-project – my experience shows the latter to be the answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my XML file chapters tag has more chapter tag.i need to display chapters
I have thousands of HTML files to process using Groovy/Java and I need to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.