I have problems compiling log4cpp 1.0 with visual c++ v6.0 with SP5 and SP6. I've downloaded the files and tried to compile but I have a lot of errors. I think it has something to do with the templates but I can't find what.
Someone can help me?
Thanks.
Compiling...
AbortAppender.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator
()(const char *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\abortappender.cpp(49) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,class
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
d:\gensnmp\hit7300\r42\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2064: term does not evaluate to a function
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\abortappender.cpp(49) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,class
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
BasicLayout.cpp
FileAppender.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\fileappender.cpp(108) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const ch
ar *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\fileappender.cpp(108) : error C2064: term does not evaluate to a function
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\fileappender.cpp(109) : error C2228: left of '.optional' must have class/struct/union type
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\fileappender.cpp(109) : warning C4138: '*/' found outside of comment
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\fileappender.cpp(109) : error C2059: syntax error : '/'
NTEventLogAppender.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\nteventlogappender.cpp(145) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(co
nst char *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\nteventlogappender.cpp(145) : error C2064: term does not evaluate to a function
PatternLayout.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\patternlayout.cpp(125) : error C2039: 'clock' : is not a member of 'std'
RemoteSyslogAppender.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\remotesyslogappender.cpp(140) : error C2039: 'sprintf' : is not a member of 'std'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\remotesyslogappender.cpp(176) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(
const char *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\remotesyslogappender.cpp(176) : error C2064: term does not evaluate to a function
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\remotesyslogappender.cpp(177) : error C2228: left of '.optional' must have class/struct/union type
RollingFileAppender.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\rollingfileappender.cpp(99) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(co
nst char *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\rollingfileappender.cpp(99) : error C2064: term does not evaluate to a function
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\rollingfileappender.cpp(101) : error C2228: left of '.optional' must have class/struct/union type
SimpleLayout.cpp
Win32DebugAppender.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator
()(const char *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\win32debugappender.cpp(46) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,c
lass std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
d:\gensnmp\hit7300\r42\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2064: term does not evaluate to a function
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\win32debugappender.cpp(46) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,c
lass std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
Error executing cl.exe.
log4cppD.lib - 18 error(s), 1 warning(s)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, I have experienced the exactly same problem. I don't know where it could be wrong. I checked the source files, they looked quite normal. But it just doesn't work. Maybe there are some SP or libraries are needed? (such as VC6SP6?)
But there is no problem compiling the version 0.3.5, Maybe you can consider using it since it's also a stable version.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
there 2 files are in the package but not included in the solution files:
factoryparams.cpp
and localtime.cpp <<<.. i already forgot if the second file is correct. but i remember the link error is complaining about the not findin the localtime .. if you check the error more clearly, you see that they are in the header files but the implementation are no where to be found in the original solution file. Just add those back and the link error will go away.
for those errors related to custom build events, they are related to not able to find the mc.link.exe, and rc.exe. just point to the correct path and those will go away too.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
--------------------Configuration: log4cppDLL - Win32 Debug--------------------
Performing Custom Build Step on ..\NTEventLogCategories.mc
MC: Compiling .\..\NTEventLogCategories.mc
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
Compiling resources...
Compiling...
AbortAppender.cpp
w:\log4cpp\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const cha
r *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
w:\log4cpp\log4cpp-1.0\src\abortappender.cpp(49) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,class std::basic_s
tring<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
w:\log4cpp\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2064: term does not evaluate to a function
w:\log4cpp\log4cpp-1.0\src\abortappender.cpp(49) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,class std::basic_s
tring<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
Appender.cpp
AppenderSkeleton.cpp
BasicConfigurator.cpp
BasicLayout.cpp
Category.cpp
CategoryStream.cpp
Configurator.cpp
DllMain.cpp
DummyThreads.cpp
FileAppender.cpp
w:\log4cpp\log4cpp-1.0\src\fileappender.cpp(108) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const char *,T &) co
nst'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
w:\log4cpp\log4cpp-1.0\src\fileappender.cpp(108) : error C2064: term does not evaluate to a function
w:\log4cpp\log4cpp-1.0\src\fileappender.cpp(109) : error C2228: left of '.optional' must have class/struct/union type
Filter.cpp
FixedContextCategory.cpp
HierarchyMaintainer.cpp
IdsaAppender.cpp
LayoutAppender.cpp
LoggingEvent.cpp
MSThreads.cpp
NDC.cpp
NTEventLogAppender.cpp
w:\log4cpp\log4cpp-1.0\src\nteventlogappender.cpp(145) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const char *,T
&) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
w:\log4cpp\log4cpp-1.0\src\nteventlogappender.cpp(145) : error C2064: term does not evaluate to a function
OmniThreads.cpp
OstreamAppender.cpp
PatternLayout.cpp
w:\log4cpp\log4cpp-1.0\src\patternlayout.cpp(125) : error C2039: 'clock' : is not a member of 'std'
PortabilityImpl.cpp
Priority.cpp
Properties.cpp
PropertyConfigurator.cpp
PropertyConfiguratorImpl.cpp
PThreads.cpp
RemoteSyslogAppender.cpp
w:\log4cpp\log4cpp-1.0\src\remotesyslogappender.cpp(140) : error C2039: 'sprintf' : is not a member of 'std'
w:\log4cpp\log4cpp-1.0\src\remotesyslogappender.cpp(177) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const char *
,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
w:\log4cpp\log4cpp-1.0\src\remotesyslogappender.cpp(177) : error C2064: term does not evaluate to a function
w:\log4cpp\log4cpp-1.0\src\remotesyslogappender.cpp(178) : error C2228: left of '.optional' must have class/struct/union type
RollingFileAppender.cpp
w:\log4cpp\log4cpp-1.0\src\rollingfileappender.cpp(99) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const char *,T
&) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
w:\log4cpp\log4cpp-1.0\src\rollingfileappender.cpp(99) : error C2064: term does not evaluate to a function
w:\log4cpp\log4cpp-1.0\src\rollingfileappender.cpp(101) : error C2228: left of '.optional' must have class/struct/union type
SimpleConfigurator.cpp
SimpleLayout.cpp
StringQueueAppender.cpp
StringUtil.cpp
TimeStamp.cpp
Win32DebugAppender.cpp
w:\log4cpp\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const cha
r *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
w:\log4cpp\log4cpp-1.0\src\win32debugappender.cpp(46) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,class std::ba
sic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
w:\log4cpp\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2064: term does not evaluate to a function
w:\log4cpp\log4cpp-1.0\src\win32debugappender.cpp(46) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,class std::ba
sic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
Error executing cl.exe.
log4cppD.dll - 17 error(s), 0 warning(s)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I recently build a workaround. But as I am not at my workplace,
I wont be able to post my workaround before Monday.
As MSVC6 has many troubles with templates - especially with non-template
classes having template functions - I decided to erase the template code
producing these errors.
What you can do is explicitly instantiating the template for the
types needed, meaning that you delete the template itself
and copy n paste the code and set the types to the ones
needed. So you actually just do the work the compiler should do :|
I know that this is more than ugly. But as MSVC6 is so bad with templates,
it has saved me much time, trying to get it to work.
I had to adjust around 15 places where templates are used and put them
in factoryparams.cpp, so that there wont show up any warnings when linking.
You have also to include factoryparams .hh/.cpp and localtime .hh/.cpp
- as mentioned above - in your project.
I replaced localtime_s with localtime and erased the std:: of (I think) std::clock
and std::time_t.
Then it worked well and the first tests in our project seemed succesful (it compiled ;-)).
Best regards, I hope I could help a bit,
I will post the actual changes on Monday or so.
Matthias Rost
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I have problems compiling log4cpp 1.0 with visual c++ v6.0 with SP5 and SP6. I've downloaded the files and tried to compile but I have a lot of errors. I think it has something to do with the templates but I can't find what.
Someone can help me?
Thanks.
Compiling...
AbortAppender.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator
()(const char *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\abortappender.cpp(49) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,class
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
d:\gensnmp\hit7300\r42\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2064: term does not evaluate to a function
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\abortappender.cpp(49) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,class
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
BasicLayout.cpp
FileAppender.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\fileappender.cpp(108) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const ch
ar *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\fileappender.cpp(108) : error C2064: term does not evaluate to a function
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\fileappender.cpp(109) : error C2228: left of '.optional' must have class/struct/union type
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\fileappender.cpp(109) : warning C4138: '*/' found outside of comment
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\fileappender.cpp(109) : error C2059: syntax error : '/'
NTEventLogAppender.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\nteventlogappender.cpp(145) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(co
nst char *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\nteventlogappender.cpp(145) : error C2064: term does not evaluate to a function
PatternLayout.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\patternlayout.cpp(125) : error C2039: 'clock' : is not a member of 'std'
RemoteSyslogAppender.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\remotesyslogappender.cpp(140) : error C2039: 'sprintf' : is not a member of 'std'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\remotesyslogappender.cpp(176) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(
const char *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\remotesyslogappender.cpp(176) : error C2064: term does not evaluate to a function
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\remotesyslogappender.cpp(177) : error C2228: left of '.optional' must have class/struct/union type
RollingFileAppender.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\rollingfileappender.cpp(99) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(co
nst char *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\rollingfileappender.cpp(99) : error C2064: term does not evaluate to a function
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\rollingfileappender.cpp(101) : error C2228: left of '.optional' must have class/struct/union type
SimpleLayout.cpp
Win32DebugAppender.cpp
d:\gensnmp\hit7300\r42\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator
()(const char *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\win32debugappender.cpp(46) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,c
lass std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
d:\gensnmp\hit7300\r42\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2064: term does not evaluate to a function
d:\gensnmp\hit7300\r42\log4cpp-1.0\src\win32debugappender.cpp(46) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,c
lass std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
Error executing cl.exe.
log4cppD.lib - 18 error(s), 1 warning(s)
Well, I have experienced the exactly same problem. I don't know where it could be wrong. I checked the source files, they looked quite normal. But it just doesn't work. Maybe there are some SP or libraries are needed? (such as VC6SP6?)
But there is no problem compiling the version 0.3.5, Maybe you can consider using it since it's also a stable version.
Hello,
I have the same problem.
Are there any ideas yet to solve it ?
=======================================================================================================================
Kompilierung läuft...
Appender.cpp
AppenderSkeleton.cpp
AbortAppender.cpp
c:\prj\vs6-projekte\sonstige\log4cpp\include\log4cpp\factoryparams.hh(85) : error C2893: Funktionsvorlage 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const char *,T &)
const' konnte nicht spezialisiert werden
Mit den folgenden Vorlagenargumenten:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
c:\prj\vs6-projekte\sonstige\log4cpp\src\abortappender.cpp(49) : Siehe Verweis auf Instantiierung der kompilierten Funktionsvorlage 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required
(const char *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const'
c:\prj\vs6-projekte\sonstige\log4cpp\include\log4cpp\factoryparams.hh(85) : error C2064: Ausdruck ergibt keine Funktion
c:\prj\vs6-projekte\sonstige\log4cpp\src\abortappender.cpp(49) : Siehe Verweis auf Instantiierung der kompilierten Funktionsvorlage 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required
(const char *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const'
=======================================================================================================================
Regards
there 2 files are in the package but not included in the solution files:
factoryparams.cpp
and localtime.cpp <<<.. i already forgot if the second file is correct. but i remember the link error is complaining about the not findin the localtime .. if you check the error more clearly, you see that they are in the header files but the implementation are no where to be found in the original solution file. Just add those back and the link error will go away.
for those errors related to custom build events, they are related to not able to find the mc.link.exe, and rc.exe. just point to the correct path and those will go away too.
Hello,
I have the same problem.
Are there any ideas yet to solve it ?
--------------------Configuration: log4cppDLL - Win32 Debug--------------------
Performing Custom Build Step on ..\NTEventLogCategories.mc
MC: Compiling .\..\NTEventLogCategories.mc
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
Compiling resources...
Compiling...
AbortAppender.cpp
w:\log4cpp\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const cha
r *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
w:\log4cpp\log4cpp-1.0\src\abortappender.cpp(49) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,class std::basic_s
tring<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
w:\log4cpp\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2064: term does not evaluate to a function
w:\log4cpp\log4cpp-1.0\src\abortappender.cpp(49) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,class std::basic_s
tring<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
Appender.cpp
AppenderSkeleton.cpp
BasicConfigurator.cpp
BasicLayout.cpp
Category.cpp
CategoryStream.cpp
Configurator.cpp
DllMain.cpp
DummyThreads.cpp
FileAppender.cpp
w:\log4cpp\log4cpp-1.0\src\fileappender.cpp(108) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const char *,T &) co
nst'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
w:\log4cpp\log4cpp-1.0\src\fileappender.cpp(108) : error C2064: term does not evaluate to a function
w:\log4cpp\log4cpp-1.0\src\fileappender.cpp(109) : error C2228: left of '.optional' must have class/struct/union type
Filter.cpp
FixedContextCategory.cpp
HierarchyMaintainer.cpp
IdsaAppender.cpp
LayoutAppender.cpp
LoggingEvent.cpp
MSThreads.cpp
NDC.cpp
NTEventLogAppender.cpp
w:\log4cpp\log4cpp-1.0\src\nteventlogappender.cpp(145) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const char *,T
&) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
w:\log4cpp\log4cpp-1.0\src\nteventlogappender.cpp(145) : error C2064: term does not evaluate to a function
OmniThreads.cpp
OstreamAppender.cpp
PatternLayout.cpp
w:\log4cpp\log4cpp-1.0\src\patternlayout.cpp(125) : error C2039: 'clock' : is not a member of 'std'
PortabilityImpl.cpp
Priority.cpp
Properties.cpp
PropertyConfigurator.cpp
PropertyConfiguratorImpl.cpp
PThreads.cpp
RemoteSyslogAppender.cpp
w:\log4cpp\log4cpp-1.0\src\remotesyslogappender.cpp(140) : error C2039: 'sprintf' : is not a member of 'std'
w:\log4cpp\log4cpp-1.0\src\remotesyslogappender.cpp(177) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const char *
,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
w:\log4cpp\log4cpp-1.0\src\remotesyslogappender.cpp(177) : error C2064: term does not evaluate to a function
w:\log4cpp\log4cpp-1.0\src\remotesyslogappender.cpp(178) : error C2228: left of '.optional' must have class/struct/union type
RollingFileAppender.cpp
w:\log4cpp\log4cpp-1.0\src\rollingfileappender.cpp(99) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const char *,T
&) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
w:\log4cpp\log4cpp-1.0\src\rollingfileappender.cpp(99) : error C2064: term does not evaluate to a function
w:\log4cpp\log4cpp-1.0\src\rollingfileappender.cpp(101) : error C2228: left of '.optional' must have class/struct/union type
SimpleConfigurator.cpp
SimpleLayout.cpp
StringQueueAppender.cpp
StringUtil.cpp
TimeStamp.cpp
Win32DebugAppender.cpp
w:\log4cpp\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2893: Failed to specialize function template 'const class log4cpp::details::required_params_validator &__thiscall log4cpp::details::required_params_validator::operator ()(const cha
r *,T &) const'
With the following template arguments:
'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
w:\log4cpp\log4cpp-1.0\src\win32debugappender.cpp(46) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,class std::ba
sic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
w:\log4cpp\log4cpp-1.0\include\log4cpp\factoryparams.hh(85) : error C2064: term does not evaluate to a function
w:\log4cpp\log4cpp-1.0\src\win32debugappender.cpp(46) : see reference to function template instantiation 'class log4cpp::details::required_params_validator __thiscall log4cpp::details::parameter_validator::required(const char *,class std::ba
sic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) const' being compiled
Error executing cl.exe.
log4cppD.dll - 17 error(s), 0 warning(s)
Hey,
I recently build a workaround. But as I am not at my workplace,
I wont be able to post my workaround before Monday.
As MSVC6 has many troubles with templates - especially with non-template
classes having template functions - I decided to erase the template code
producing these errors.
What you can do is explicitly instantiating the template for the
types needed, meaning that you delete the template itself
and copy n paste the code and set the types to the ones
needed. So you actually just do the work the compiler should do :|
I know that this is more than ugly. But as MSVC6 is so bad with templates,
it has saved me much time, trying to get it to work.
I had to adjust around 15 places where templates are used and put them
in factoryparams.cpp, so that there wont show up any warnings when linking.
You have also to include factoryparams .hh/.cpp and localtime .hh/.cpp
- as mentioned above - in your project.
I replaced localtime_s with localtime and erased the std:: of (I think) std::clock
and std::time_t.
Then it worked well and the first tests in our project seemed succesful (it compiled ;-)).
Best regards, I hope I could help a bit,
I will post the actual changes on Monday or so.
Matthias Rost
Thanks matthiasrost!
So, here we are again:
I think I'll just post factoryparams.cpp / .hpp.
The rest of the changes I made and the explanation
are described above.
factoryparams.cpp
------------------------------
#include <log4cpp/FactoryParams.hh>
#include <stdexcept>
#include <string>
namespace log4cpp
{
const std::string& FactoryParams::operator[](const std::string& v) const
{
const_iterator i = storage_.find(v);
if (i != storage_.end())
return i->second;
throw std::invalid_argument("There is no parameter '" + v + "'");
}
FactoryParams::const_iterator FactoryParams::find(const std::string& v) const
{
return storage_.find(v);
}
details::optional_params_validator details::required_params_validator::optional(const char* param, int& value) const { optional_params_validator v(tag_, params_); v(param, value); return v; }
details::optional_params_validator details::required_params_validator::optional(const char* param, bool& value) const { optional_params_validator v(tag_, params_); v(param, value); return v; }
details::optional_params_validator details::required_params_validator::optional(const char* param, std::string& value) const { optional_params_validator v(tag_, params_); v(param, value); return v; }
const details::required_params_validator& details::required_params_validator::operator()(const char* param, std::string& value) const
{
FactoryParams::const_iterator i = params_->find(param);
if (i != params_->end())
assign(i->second, value);
else
throw_error(param);
return *this;
}
const details::required_params_validator& details::required_params_validator::operator()(const char* param, int& value) const
{
FactoryParams::const_iterator i = params_->find(param);
if (i != params_->end())
assign(i->second, value);
else
throw_error(param);
return *this;
}
const details::optional_params_validator& details::optional_params_validator::operator()(const char* param, int& value) const
{
FactoryParams::const_iterator i = params_->find(param);
if (i != params_->end())
assign(i->second, value);
return *this;
}
const details::optional_params_validator& details::optional_params_validator::operator()(const char* param, bool& value) const
{
FactoryParams::const_iterator i = params_->find(param);
if (i != params_->end())
assign(i->second, value);
return *this;
}
const details::optional_params_validator& details::optional_params_validator::operator()(const char* param, std::string& value) const
{
FactoryParams::const_iterator i = params_->find(param);
if (i != params_->end())
assign(i->second, value);
return *this;
}
}
FactoryParams.hpp
---------------------------------------
#if !defined(h_3e645482_ae6a_43e5_8f81_abbc4200212d)
#define h_3e645482_ae6a_43e5_8f81_abbc4200212d
#pragma warning(disable:4786)
#include <map>
#include <string>
#include <sstream>
#include <stdexcept>
#include "Portability.hh"
namespace log4cpp
{
class FactoryParams;
namespace details
{
class base_validator_data
{
public:
base_validator_data(const char* tag, const FactoryParams* params) : tag_(tag), params_(params){}
protected:
const char* tag_;
const FactoryParams* params_;
template<typename T>
void assign(const std::string& param_value, T& value) const
{
assign_impl(param_value, value);
}
template<typename T>
void assign_impl(const std::string& param_value, T& value) const
{
std::stringstream s;
s << param_value;
s >> value;
}
void assign_impl(const std::string& param_value, std::string& value) const
{
value = param_value;
}
void throw_error(const char* param_name) const
{
std::stringstream s;
s << "Property '" << param_name << "' required to configure " << tag_;
throw std::runtime_error(s.str());
}
};
class optional_params_validator;
class required_params_validator : public base_validator_data
{
public:
required_params_validator(const char* tag, const FactoryParams* params) : base_validator_data(tag, params) {}
optional_params_validator optional(const char* param, int& value) const;
optional_params_validator optional(const char* param, bool& value) const;
optional_params_validator optional(const char* param, std::string& value) const;
const required_params_validator& operator()(const char* param, std::string& value) const;
const required_params_validator& operator()(const char* param, int& value) const;
};
class optional_params_validator : public base_validator_data
{
public:
optional_params_validator(const char* tag, const FactoryParams* params) : base_validator_data(tag, params) {}
template<typename T>
required_params_validator required(const char* param, T& value) const { required_params_validator v(tag_, params_); v(param, value); return v; }
const optional_params_validator& operator()(const char* param, int& value) const;
const optional_params_validator& operator()(const char* param, bool& value) const;
const optional_params_validator& operator()(const char* param, std::string& value) const;
};
class parameter_validator : public base_validator_data
{
public:
parameter_validator(const char* tag, const FactoryParams* params) : base_validator_data(tag, params) {}
template<typename T>
required_params_validator required(const char* param, T& value) const { required_params_validator v(tag_, params_); v(param, value); return v; }
template<typename T>
optional_params_validator optional(const char* param, T& value) const { optional_params_validator v(tag_, params_); v(param, value); return v; }
};
}
class LOG4CPP_EXPORT FactoryParams
{
typedef std::map<std::string, std::string> storage_t;
storage_t storage_;
public:
typedef storage_t::const_iterator const_iterator;
const std::string& operator[](const std::string& v) const;
std::string& operator[](const std::string& v) { return storage_[v]; }
details::parameter_validator get_for(const char* tag) const { return details::parameter_validator(tag, this); }
const_iterator find(const std::string& t) const;
const_iterator begin() const { return storage_.begin(); }
const_iterator end() const { return storage_.end(); }
private:
/*typedef std::map<std::string, std::string> storage_t;
storage_t storage_; */
};
}
#endif // h_3e645482_ae6a_43e5_8f81_abbc4200212d
Best wishes,
Matthias Rost