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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:02:09+00:00 2026-05-23T14:02:09+00:00

We have a custom Logging class which compiles fine in VisualStudio 2010, but throws

  • 0

We have a custom Logging class which compiles fine in VisualStudio 2010, but throws errors when being compiled with g++ on Linux. The error message we receive are the following:

Logger.hpp:84: error: declaration of "operator<<" as non-function
Logger.hpp:84: error: expected ";" before "(" token
Logger.hpp:91: error: expected ";" before "inline"
Logger.hpp:91: error: declaration of "operator<<" as non-function
Logger.hpp:91: error: expected ";" before "(" token
Logger.hpp:98: error: expected ";" before "typedef"

The respective lines of code are the following:

/*:84*/inline Logger& operator<<(std::_Smanip<std::ios_base::fmtflags> output)
{
        if (this->loggingEnabled())
                std::cout << output;
        return *this;
}

inline Logger& operator<<(std::_Smanip<std::streamsize> output)
{
        if (this->loggingEnabled())
                std::cout << output;
        return *this;
}

typedef std::basic_ostream<char, std::char_traits<char> >& (*StdEndl)(std::basic_ostream<char, std::char_traits<char> >&);
inline Logger& operator<<(StdEndl output)
{
        if (this->loggingEnabled())
                std::cout << output;
        return *this;
}

Other methods overloading the << operator work fine, therefore my guess is that the errors have something to with the argument type (std::_Smanip); any clues as to why?

Thanks,
Ben

  • 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-05-23T14:02:09+00:00Added an answer on May 23, 2026 at 2:02 pm

    _Smanip is a Microsoft extension, and not part of the standard library. That’s why your code compiles under Visual C++.

    Here’s an MSDN article on the use of _Smanip, and here’s another one of how to avoid using it and write portable code instead.

    EDIT: Found another link that explains manipulators with parameters in great detail. They discuss methods to implement custom ones as well.

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

Sidebar

Related Questions

I have custom errors configured in my web.config, but IIS 6.0 is returning the
I have a custom logging system which allows me to send information to a
I have implemented my own custom Logger for my django site: class SpecialLogger(logging.Logger): def
I have a custom logging class for my Python script with a flush() method
I am creating a custom cookie and have overloaded the Iprincipal class and all
I have a custom logging function to log to the firebug console that looks
I have a framework library which would do a lot of things including logging.
All, I have to redesign an existing logging system being used in web application.
I'm looking at making a logging class which has members like Info, Error etc
At the company I work for, I have created a Error Logging class to

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.