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 7897717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:14:20+00:00 2026-06-03T08:14:20+00:00

I’m porting http://www.drdobbs.com/embedded-systems/225700666 to Keil MDK for ARM microprocessors. The framework compiles and works

  • 0

I’m porting http://www.drdobbs.com/embedded-systems/225700666 to Keil MDK for ARM microprocessors. The framework compiles and works fine using gcc on my desktop but using the Keil compiler gives me an error:

logging/singleton.h(65): error: #70: incomplete type is not allowed

Following code shows the implementation of a singletonwhere I get this error. Where does this error come from?

namespace logging {

  namespace detail {

      template <typename T>
      class singleton
      {
        private:
          struct obj
          {
            obj() { singleton<T>::instance(); }
            inline void empty() const { }
          };
          static obj __obj;

          singleton();

        public:
          typedef T obj_type;

          static obj_type & instance()
          {
            static obj_type obj;  // <-- Here I get this error

            __obj.empty();

            return obj;
          }
      };
      template <typename T>
      typename singleton<T>::obj
      singleton<T>::__obj;

  } /* detail */
} /* logging */

Edit:
The singletongets instantiated here

template <typename log_t, typename T>
struct Obj {
    static return_type& obj () {
        typedef singleton<return_type> log_output;
        return log_output::instance();
    }
}; 

where return_type is a typedef:

typedef R return_type;

and that’s a parameter of the parent template:

template<typename Level = ::logging::Void, typename R = loggingReturnType>
    class Logger {
       ...
    };

loggingReturnType is forward declarated above the class definition:

struct loggingReturnType;

Edit 2:
This loggingReturnType gets generated through following makro.

#define LOGGING_DEFINE_OUTPUT(BASE)                                           \
namespace logging {                                                           \
    struct loggingReturnType : public BASE {                                  \
            /*! \brief The provided typedef is used for compile time          \
             *         selection of different implementation of the           \
             *         %logging framework. Thus, it is necessary              \
             *         that any output type supports this type                \
             *         definition, why it is defined here.                    \
             */                                                               \
            typedef BASE    output_base_type;                                 \
        };                                                                    \
}

This makro gets called in a config header.

Edit 3:
Her is a link to the preprocessor output: http://www.pasteall.org/31617/cpp. This file compiles pretty using g++. The definition of loggingReturnTypeis the last before the main – so the singleton doesn’t the exact type but nevertheless it works. I also looked at the preprocessor output of the Keil compiler and it’s almost the same.

So what went wrong here?

  • 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-03T08:14:22+00:00Added an answer on June 3, 2026 at 8:14 am

    According to the information you put here, the error message makes perfect sense. The code is trying to created an instance of an object on the stack. This object’s type is only forward declared but no definition is available to the compiler at that time.

    You need to make the definition of this type available to the compiler before it has to create an instance of this type.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

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.