Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build with -Wall -Werror flags and GCC #620

Closed
r2d2leboss opened this issue Feb 27, 2018 · 4 comments
Closed

Unable to build with -Wall -Werror flags and GCC #620

r2d2leboss opened this issue Feb 27, 2018 · 4 comments

Comments

@r2d2leboss
Copy link

r2d2leboss commented Feb 27, 2018

We're using -Wall -Werror and we would like to add Easylogging++ support. However, it looks like Easylogging++ is unable to build with -Wall -Werror flags. I can't even compile the hello world provided in the README. Output is given below. I don't have errors with Clang.

To reproduce:

g++ main.cpp easylogging++.cc -o prog -std=c++11 -Wall -Werror

main.cpp

#include "easylogging++.h"

INITIALIZE_EASYLOGGINGPP

int main(int argc, char* argv[]) {
   LOG(INFO) << "My first info log using default logger";
   return 0;
}

Output:

In file included from main.cpp:1:0:
easylogging++.h:731:34: error: 'el::base::consts::kInfoLevelLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kInfoLevelLogValue = ELPP_LITERAL("INFO");
^
easylogging++.h:732:34: error: 'el::base::consts::kDebugLevelLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kDebugLevelLogValue = ELPP_LITERAL("DEBUG");
^
easylogging++.h:733:34: error: 'el::base::consts::kWarningLevelLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kWarningLevelLogValue = ELPP_LITERAL("WARNING");
^
easylogging++.h:734:34: error: 'el::base::consts::kErrorLevelLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kErrorLevelLogValue = ELPP_LITERAL("ERROR");
^
easylogging++.h:735:34: error: 'el::base::consts::kFatalLevelLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kFatalLevelLogValue = ELPP_LITERAL("FATAL");
^
easylogging++.h:736:34: error: 'el::base::consts::kVerboseLevelLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kVerboseLevelLogValue =
^
easylogging++.h:738:34: error: 'el::base::consts::kTraceLevelLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kTraceLevelLogValue = ELPP_LITERAL("TRACE");
^
easylogging++.h:739:34: error: 'el::base::consts::kInfoLevelShortLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kInfoLevelShortLogValue = ELPP_LITERAL("I");
^
easylogging++.h:740:34: error: 'el::base::consts::kDebugLevelShortLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kDebugLevelShortLogValue = ELPP_LITERAL("D");
^
easylogging++.h:741:34: error: 'el::base::consts::kWarningLevelShortLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kWarningLevelShortLogValue = ELPP_LITERAL("W");
^
easylogging++.h:742:34: error: 'el::base::consts::kErrorLevelShortLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kErrorLevelShortLogValue = ELPP_LITERAL("E");
^
easylogging++.h:743:34: error: 'el::base::consts::kFatalLevelShortLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kFatalLevelShortLogValue = ELPP_LITERAL("F");
^
easylogging++.h:744:34: error: 'el::base::consts::kVerboseLevelShortLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kVerboseLevelShortLogValue = ELPP_LITERAL("V");
^
easylogging++.h:745:34: error: 'el::base::consts::kTraceLevelShortLogValue' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kTraceLevelShortLogValue = ELPP_LITERAL("T");
^
easylogging++.h:747:34: error: 'el::base::consts::kAppNameFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kAppNameFormatSpecifier = ELPP_LITERAL("%app");
^
easylogging++.h:748:34: error: 'el::base::consts::kLoggerIdFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kLoggerIdFormatSpecifier = ELPP_LITERAL("%logger");
^
easylogging++.h:749:34: error: 'el::base::consts::kThreadIdFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kThreadIdFormatSpecifier = ELPP_LITERAL("%thread");
^
easylogging++.h:750:34: error: 'el::base::consts::kSeverityLevelFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kSeverityLevelFormatSpecifier = ELPP_LITERAL("%level");
^
easylogging++.h:751:34: error: 'el::base::consts::kSeverityLevelShortFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kSeverityLevelShortFormatSpecifier = ELPP_LITERAL("%levshort");
^
easylogging++.h:752:34: error: 'el::base::consts::kDateTimeFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kDateTimeFormatSpecifier = ELPP_LITERAL("%datetime");
^
easylogging++.h:753:34: error: 'el::base::consts::kLogFileFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kLogFileFormatSpecifier = ELPP_LITERAL("%file");
^
easylogging++.h:754:34: error: 'el::base::consts::kLogFileBaseFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kLogFileBaseFormatSpecifier = ELPP_LITERAL("%fbase");
^
easylogging++.h:755:34: error: 'el::base::consts::kLogLineFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kLogLineFormatSpecifier = ELPP_LITERAL("%line");
^
easylogging++.h:756:34: error: 'el::base::consts::kLogLocationFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kLogLocationFormatSpecifier = ELPP_LITERAL("%loc");
^
easylogging++.h:757:34: error: 'el::base::consts::kLogFunctionFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kLogFunctionFormatSpecifier = ELPP_LITERAL("%func");
^
easylogging++.h:758:34: error: 'el::base::consts::kCurrentUserFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kCurrentUserFormatSpecifier = ELPP_LITERAL("%user");
^
easylogging++.h:759:34: error: 'el::base::consts::kCurrentHostFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kCurrentHostFormatSpecifier = ELPP_LITERAL("%host");
^
easylogging++.h:760:34: error: 'el::base::consts::kMessageFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kMessageFormatSpecifier = ELPP_LITERAL("%msg");
^
easylogging++.h:761:34: error: 'el::base::consts::kVerboseLevelFormatSpecifier' defined but not used [-Werror=unused-variable]
static const base::type::char_t* kVerboseLevelFormatSpecifier = ELPP_LITERAL("%vlevel");
^
easylogging++.h:762:20: error: 'el::base::consts::kDateTimeFormatSpecifierForFilename' defined but not used [-Werror=unused-variable]
static const char* kDateTimeFormatSpecifierForFilename = "%datetime";
^
easylogging++.h:764:20: error: 'el::base::consts::kDays' defined but not used [-Werror=unused-variable]
static const char* kDays[7] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
^
In file included from main.cpp:1:0:
easylogging++.h:765:20: error: 'el::base::consts::kDaysAbbrev' defined but not used [-Werror=unused-variable]
static const char* kDaysAbbrev[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
^
easylogging++.h:766:20: error: 'el::base::consts::kMonths' defined but not used [-Werror=unused-variable]
static const char* kMonths[12] = { "January", "February", "March", "Apri", "May", "June", "July", "August",
^
easylogging++.h:769:20: error: 'el::base::consts::kMonthsAbbrev' defined but not used [-Werror=unused-variable]
static const char* kMonthsAbbrev[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
^
easylogging++.h:770:20: error: 'el::base::consts::kDefaultDateTimeFormat' defined but not used [-Werror=unused-variable]
static const char* kDefaultDateTimeFormat = "%Y-%M-%d %H:%m:%s,%g";
^
easylogging++.h:771:20: error: 'el::base::consts::kDefaultDateTimeFormatInFilename' defined but not used [-Werror=unused-variable]
static const char* kDefaultDateTimeFormatInFilename = "%Y-%M-%d_%H-%m";
^
easylogging++.h:773:20: error: 'el::base::consts::kAm' defined but not used [-Werror=unused-variable]
static const char* kAm = "AM";
^
easylogging++.h:774:20: error: 'el::base::consts::kPm' defined but not used [-Werror=unused-variable]
static const char* kPm = "PM";
^
easylogging++.h:784:20: error: 'el::base::consts::kPerformanceLoggerId' defined but not used [-Werror=unused-variable]
static const char* kPerformanceLoggerId = "performance";
^
easylogging++.h:789:20: error: 'el::base::consts::kNullPointer' defined but not used [-Werror=unused-variable]
static const char* kNullPointer = "nullptr";
^
easylogging++.h:798:20: error: 'el::base::consts::kUnknownUser' defined but not used [-Werror=unused-variable]
static const char* kUnknownUser = "user";
^
easylogging++.h:799:20: error: 'el::base::consts::kUnknownHost' defined but not used [-Werror=unused-variable]
static const char* kUnknownHost = "unknown-host";
^
easylogging++.h:807:20: error: 'el::base::consts::kDefaultLogFile' defined but not used [-Werror=unused-variable]
static const char* kDefaultLogFile = "logs/myeasylog.log";
^
easylogging++.h:814:20: error: 'el::base::consts::kDefaultLogFileParam' defined but not used [-Werror=unused-variable]
static const char* kDefaultLogFileParam = "--default-log-file";
^
easylogging++.h:824:20: error: 'el::base::consts::kValidLoggerIdSymbols' defined but not used [-Werror=unused-variable]
static const char* kValidLoggerIdSymbols =
^
easylogging++.h:826:20: error: 'el::base::consts::kConfigurationComment' defined but not used [-Werror=unused-variable]
static const char* kConfigurationComment = "##";
^
easylogging++.h:827:20: error: 'el::base::consts::kConfigurationLevel' defined but not used [-Werror=unused-variable]
static const char* kConfigurationLevel = "";
^
easylogging++.h:828:20: error: 'el::base::consts::kConfigurationLoggerId' defined but not used [-Werror=unused-variable]
static const char
kConfigurationLoggerId = "--";
^
cc1plus: all warnings being treated as errors

@r2d2leboss r2d2leboss changed the title Unable to build with -Wall -Werror flag and GCC Unable to build with -Wall -Werror flags and GCC Feb 27, 2018
@abumq
Copy link
Owner

abumq commented Feb 27, 2018

I will address this in next release

@rkfg
Copy link

rkfg commented May 19, 2018

One issue left:

easylogging++.h:740:20: error: ‘el::base::consts::kPerformanceLoggerId’ defined but not used [-Werror=unused-variable]
 static const char* kPerformanceLoggerId                    =      "performance";
                    ^~~~~~~~~~~~~~~~~~~~

@maywine
Copy link

maywine commented May 23, 2018

I also got this problem:
easylogging++.h:740:20: error: ‘el::base::consts::kPerformanceLoggerId’ defined but not used [-Werror=unused-variable]
static const char* kPerformanceLoggerId = "performance";

@benrubson
Copy link
Contributor

Also facing this :

‘el::base::consts::kSysLogLoggerId’ defined but not used [-Wunused-variable]
783 static const char* kSysLogLoggerId                         =      "syslog";

Did you manage to get rid of this ?
Thx 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants