You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Lars Schouw <sc...@yahoo.com> on 2004/05/19 09:36:53 UTC
Linking static libs under VC7.1 does not work
I just tried to link the trivial example project with the static build library log4cxxs.lib but get a link error.
I am using log4cxx version 0.9.7.
Any ideas? I want to use the static library in my real application.
------ Build started: Project: trivial, Configuration: Debug Win32 ------
Linking...
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall log4cxx::Logger::fatal(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *,int)" (__imp_?fatal@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall log4cxx::Logger::error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *,int)" (__imp_?error@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall log4cxx::Logger::warn(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *,int)" (__imp_?warn@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall log4cxx::Logger::info(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *,int)" (__imp_?info@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall log4cxx::Logger::debug(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *,int)" (__imp_?debug@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl log4cxx::NDC::push(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?push@NDC@log4cxx@@SAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Logger> __cdecl log4cxx::Logger::getRootLogger(void)" (__imp_?getRootLogger@Logger@log4cxx@@SA?AV?$ObjectPtrT@VLogger@log4cxx@@@helpers@2@XZ) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl log4cxx::BasicConfigurator::configure(void)" (__imp_?configure@BasicConfigurator@log4cxx@@SAXXZ) referenced in function _main
../Bin/Debug/trivial.exe : fatal error LNK1120: 8 unresolved externals
Build log was saved at "file://c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\BuildLog.htm"
trivial - 9 error(s), 1 warning(s)
---------------------------------
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
Minor bug in the documentation
Posted by Lars Schouw <sc...@yahoo.com>.
There are missing two % on the web page.
http://logging.apache.org/log4cxx/manual/Introduction.html
log4j.appender.stdout.layout.ConversionPattern=%5p [t] (F:L) - m%n
should be
log4j.appender.stdout.layout.ConversionPattern=%5p [t] (F:L) - %m%n
and
log4j.appender.R.layout.ConversionPattern=%p t c - m%n
should be
log4j.appender.R.layout.ConversionPattern=%p t c - %m%n
log4j.rootLogger=debug, stdout, R
log4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.log4j.appender.stdout.layout.ConversionPattern=%5p [t] (F:L) - m%n
log4j.appender.R=org.apache.log4j.RollingFileAppenderlog4j.appender.R.File=example.log
log4j.appender.R.MaxFileSize=100KB
# Keep one backup filelog4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayoutlog4j.appender.R.layout.ConversionPattern=%p t c - m%n
---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
Re: libsmtp
Posted by Lars Schouw <sc...@yahoo.com>.
Salue Micha�l
I found a weblog that explains how to do it in C++.
http://www.vbbox.com/blog/2004/05/remember-cdosys-and-some-c-code.html
Lars
Michael CATANZARITI <mc...@free.fr> wrote:
Hello Lars,
libsmtp is not available for Windows.
Under Windows, I intented to implement the SMTPAppender with the library CDO
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/exchanchor/htms/msexchsvr_cdowin2000.asp
But I didn't find the time.
Micha�l
Selon Lars Schouw :
> I can't find anyone for Windows.
> Any ideas?
> Lars
>
>
> ---------------------------------
> Do you Yahoo!?
> Friends. Fun. Try the all-new Yahoo! Messenger
---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
Re: libsmtp
Posted by Michael CATANZARITI <mc...@free.fr>.
Hello Lars,
libsmtp is not available for Windows.
Under Windows, I intented to implement the SMTPAppender with the library CDO
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/exchanchor/htms/msexchsvr_cdowin2000.asp
But I didn't find the time.
Michaël
Selon Lars Schouw <sc...@yahoo.com>:
> I can't find anyone for Windows.
> Any ideas?
> Lars
>
>
> ---------------------------------
> Do you Yahoo!?
> Friends. Fun. Try the all-new Yahoo! Messenger
libsmtp
Posted by Lars Schouw <sc...@yahoo.com>.
I can't find anyone for Windows.
Any ideas?
Lars
---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
Re: libsmtp.h is missing
Posted by Lars Schouw <sc...@yahoo.com>.
Found out I need to download libsmtp as well.
http://freshmeat.net/projects/libsmtp/
Lars
---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
Re: You have tried to set a null level to root.
Posted by Michaël CATANZARITI <mc...@free.fr>.
log4cxx tests (built with cppunit) are passed successfully under linux,
and Windows (VC6 and VC7) before each version release.
Michaël
Lars Schouw wrote:
> Would be nice to have cppunit up and running as well.
> This will make testring much easier in the future.
> Version 1.9.14 works under Visual C++ 7.1 / Visual Studio 2003 as well.
> Lars
>
>
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Friends. Fun. Try the all-new Yahoo! Messenger
> <http://messenger.yahoo.com/>
Re: You have tried to set a null level to root.
Posted by Lars Schouw <sc...@yahoo.com>.
Would be nice to have cppunit up and running as well.
This will make testring much easier in the future.
Version 1.9.14 works under Visual C++ 7.1 / Visual Studio 2003 as well.
Lars
---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
libsmtp.h missing
Posted by Lars Schouw <sc...@yahoo.com>.
I tried to define HAVE_SMTP while building.
It tells me that the file libsmtp.h missing is missing while building smtpappender.cpp.
I had a quick look in CVS but could not find it there.
Any ideas?
I have version 0.9.7
Lars
---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
Re: You have tried to set a null level to root.
Posted by Michaël CATANZARITI <mc...@free.fr>.
Lars,
I am wondering if I should not review the whole initialization of
log4cxx for similar problems occur under MacOSX and HPUX.
Michaël
Lars Schouw wrote:
> Michaël
>
> It works now. ;) Will this go into CVS?
>
> Lars
>
> */Michaël_CATANZARITI <mc...@free.fr>/* wrote:
>
> Hello,
>
> It seems the problem is related to the construction order of static
> variables.
>
> Visual C++ 7.1, constructs static variables in the declaration
> order for
> each source file, and in the link order of each obj file and
> library for
> a whole module.
> So, the static variable used in the delayedloop example is
> constructed
> before the static variables declared in log4cxxs.lib (for the linker
> parse delayedloop.obj first).
> Accordingly, the static variables concerning levels, implemented in
> level.cpp are initialized later. This is was the rootLogger level
> seems
> not to be set.
>
> Please add the following lines on top of the files level.cpp and
> logmanager.cpp :
>
> // Force initialization early.
> #pragma warning(disable: 4074)
> #pragma warning(disable: 4073)
> #pragma init_seg(lib)
>
>
>
> The directive '#pragma init_seg(lib)' permits to force the static
> variables implemented in its scope to be initialized first.
>
> Michaël
>
> Lennart Goedhart wrote:
>
> >Yeah, I have the same problem if I try to use the static log4cxx
> library.
> >It's dumping at the point it's trying to assign the static
> Bar::logger.
> >It works fine if you use the log4cxx.lib (therefore the dll).
> >As to why this is the case, that's a question for one of the log4cxx
> >developers, I guess.
> >
> >----- Original Message -----
> >From: "Lars Schouw"
> >To: "Log4CXX User"
> >Sent: Thursday, May 20, 2004 7:32 PM
> >Subject: Re: You have tried to set a null level to root.
> >
> >
> >
> >
> >>Lennart
> >>
> >>You are really a great help thank for always answering
> >>so quick!
> >>
> >>It dumps before that it even gets to there!
> >>
> >>I took out the A2W here A2W(argv[1]); as well since
> >>since my code is not unicode.
> >>
> >>I pass the following into the program as a startup
> >>argument. config/LogSettings.txt
> >>
> >>Well I have this configuration file called
> >>LogSettings.txt
> >>
> >># Set root logger level to DEBUG and its only appender
> >>to A1.
> >>log4j.rootLogger=DEBUG, A1
> >>
> >># A1 is set to be a ConsoleAppender.
> >>log4j.appender.A1=org.apache.log4j.ConsoleAppender
> >>
> >># A1 uses PatternLayout.
> >>log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> >>log4j.appender.A1.layout.ConversionPattern=%d [%t]
> >>%-5p %c %x - %m (F:L)%n
> >>
> >>Also in the meanwhile I tried to setup the trivial
> >>project replacing the code with the bar sample you
> >>have in the documentation.
> >>When I run it I get an error like before
> >>You have tried to set a null level to root.
> >>and in this case it runs down the sample code until
> >>this line is called:
> >>logger->info(_T("Entering application."));
> >>where an exception is thrown.
> >>In the console I get this.
> >>First-chance exception at 0x77e73887 in trivial.exe:
> >>Microsoft C++ exception:
> >>log4cxx::helpers::RuntimeException @ 0x0012fddc.
> >>Please be awair the the code is not the trivial.cpp
> >>from your sample but the code from the documentation.
> >>
> >>Again I am using the static library I compiled myself.
> >>
> >>Also one more thing when I build I get some warnings.
> >>They come from an error in the documentation;
> >>#include ;
> >>Should be without the last semicolon.
> >>
> >>
> >>
> >>
> >>Regards
> >>Lars Schouw
> >>
> >>--- Lennart Goedhart wrote:
> >>
> >>
> >>>I assume you get this when you pass the arg of the
> >>>config file. What does your config file look like?
> >>>When I comile that snippet of your code (with a few
> >>>minor changes), it works fine.
> >>>I have he logfile I pass working with Conole,
> >>>RollingFile and ODBC appenders...
> >>> ----- Original Message -----
> >>> From: Lars Schouw
> >>> To: Log4CXX User
> >>> Sent: Thursday, May 20, 2004 5:23 PM
> >>> Subject: Re: You have tried to set a null level to
> >>>root.
> >>>
> >>>
> >>> Sorry forgot to tell that I also have a static
> >>>variable declared in a header file
> >>> static log4cxx::LoggerPtr logger;
> >>>
> >>>
> >>>
> >>> Lars Schouw wrote:
> >>> I tried to add a configuration file to my
> >>>project but
> >>> when I run it I get this error:
> >>> You have tried to set a null level to root.
> >>> and an exception it thrown.
> >>> This is before I even hit the main function so
> >>>it must
> >>> belong to the static variable I declared the is
> >>> initialized when the object is loaded.
> >>>
> >>> My souce code:
> >>>
> >>> // include log4cxx header files.
> >>> #include
> >>> #include
> >>> #include
> >>> #include
> >>>
> >>> using namespace log4cxx;
> >>> using namespace log4cxx::helpers;
> >>>
> >>> // Define a static logger variable so that it
> >>> references the logger instance named "RALtest".
> >>> LoggerPtr logger =
> >>>Logger::getLogger(_T("RALtest"));
> >>>
> >>> int main(int argc, char* argv[])
> >>> {
> >>> int result = EXIT_SUCCESS;
> >>> try
> >>> {
> >>> if (argc > 1)
> >>> {
> >>> USES_CONVERSION;
> >>> String propertyFileName = argv[1];
> >>>
> >>>PropertyConfigurator::configure(propertyFileName);
> >>> }
> >>> else
> >>> {
> >>> BasicConfigurator::configure();
> >>> }
> >>>
> >>> logger->info(_T("Entering RALtest
> >>>application."));
> >>> ....
> >>>
> >>> Lars
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> __________________________________
> >>> Do you Yahoo!?
> >>> Yahoo! Domains - Claim yours for only
> >>>$14.70/year
> >>> http://smallbusiness.promotions.yahoo.com/offer
> >>>
> >>>
> >>>
> >>>
> >>>
> >>--------------------------------------------------------------------------
> >>
> >>
> >----
> >
> >
> >>> Do you Yahoo!?
> >>> Yahoo! Domains - Claim yours for only $14.70/year
> >>>
> >>>
> >>
> >>
> >>
> >>__________________________________
> >>Do you Yahoo!?
> >>Yahoo! Domains - Claim yours for only $14.70/year
> >>http://smallbusiness.promotions.yahoo.com/offer
> >>
> >>
> >
> >
> >
> >
> >
>
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Friends. Fun. Try the all-new Yahoo! Messenger
> <http://messenger.yahoo.com/>
Re: You have tried to set a null level to root.
Posted by Lars Schouw <sc...@yahoo.com>.
Micha�l
It works now. ;) Will this go into CVS?
Lars
Micha�l_CATANZARITI <mc...@free.fr> wrote:
Hello,
It seems the problem is related to the construction order of static
variables.
Visual C++ 7.1, constructs static variables in the declaration order for
each source file, and in the link order of each obj file and library for
a whole module.
So, the static variable used in the delayedloop example is constructed
before the static variables declared in log4cxxs.lib (for the linker
parse delayedloop.obj first).
Accordingly, the static variables concerning levels, implemented in
level.cpp are initialized later. This is was the rootLogger level seems
not to be set.
Please add the following lines on top of the files level.cpp and
logmanager.cpp :
// Force initialization early.
#pragma warning(disable: 4074)
#pragma warning(disable: 4073)
#pragma init_seg(lib)
The directive '#pragma init_seg(lib)' permits to force the static variables implemented in its scope to be initialized first.
Micha�l
Lennart Goedhart wrote:
>Yeah, I have the same problem if I try to use the static log4cxx library.
>It's dumping at the point it's trying to assign the static Bar::logger.
>It works fine if you use the log4cxx.lib (therefore the dll).
>As to why this is the case, that's a question for one of the log4cxx
>developers, I guess.
>
>----- Original Message -----
>From: "Lars Schouw"
>To: "Log4CXX User"
>Sent: Thursday, May 20, 2004 7:32 PM
>Subject: Re: You have tried to set a null level to root.
>
>
>
>
>>Lennart
>>
>>You are really a great help thank for always answering
>>so quick!
>>
>>It dumps before that it even gets to there!
>>
>>I took out the A2W here A2W(argv[1]); as well since
>>since my code is not unicode.
>>
>>I pass the following into the program as a startup
>>argument. config/LogSettings.txt
>>
>>Well I have this configuration file called
>>LogSettings.txt
>>
>># Set root logger level to DEBUG and its only appender
>>to A1.
>>log4j.rootLogger=DEBUG, A1
>>
>># A1 is set to be a ConsoleAppender.
>>log4j.appender.A1=org.apache.log4j.ConsoleAppender
>>
>># A1 uses PatternLayout.
>>log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>>log4j.appender.A1.layout.ConversionPattern=%d [%t]
>>%-5p %c %x - %m (F:L)%n
>>
>>Also in the meanwhile I tried to setup the trivial
>>project replacing the code with the bar sample you
>>have in the documentation.
>>When I run it I get an error like before
>>You have tried to set a null level to root.
>>and in this case it runs down the sample code until
>>this line is called:
>>logger->info(_T("Entering application."));
>>where an exception is thrown.
>>In the console I get this.
>>First-chance exception at 0x77e73887 in trivial.exe:
>>Microsoft C++ exception:
>>log4cxx::helpers::RuntimeException @ 0x0012fddc.
>>Please be awair the the code is not the trivial.cpp
>>from your sample but the code from the documentation.
>>
>>Again I am using the static library I compiled myself.
>>
>>Also one more thing when I build I get some warnings.
>>They come from an error in the documentation;
>>#include ;
>>Should be without the last semicolon.
>>
>>
>>
>>
>>Regards
>>Lars Schouw
>>
>>--- Lennart Goedhart wrote:
>>
>>
>>>I assume you get this when you pass the arg of the
>>>config file. What does your config file look like?
>>>When I comile that snippet of your code (with a few
>>>minor changes), it works fine.
>>>I have he logfile I pass working with Conole,
>>>RollingFile and ODBC appenders...
>>> ----- Original Message -----
>>> From: Lars Schouw
>>> To: Log4CXX User
>>> Sent: Thursday, May 20, 2004 5:23 PM
>>> Subject: Re: You have tried to set a null level to
>>>root.
>>>
>>>
>>> Sorry forgot to tell that I also have a static
>>>variable declared in a header file
>>> static log4cxx::LoggerPtr logger;
>>>
>>>
>>>
>>> Lars Schouw wrote:
>>> I tried to add a configuration file to my
>>>project but
>>> when I run it I get this error:
>>> You have tried to set a null level to root.
>>> and an exception it thrown.
>>> This is before I even hit the main function so
>>>it must
>>> belong to the static variable I declared the is
>>> initialized when the object is loaded.
>>>
>>> My souce code:
>>>
>>> // include log4cxx header files.
>>> #include
>>> #include
>>> #include
>>> #include
>>>
>>> using namespace log4cxx;
>>> using namespace log4cxx::helpers;
>>>
>>> // Define a static logger variable so that it
>>> references the logger instance named "RALtest".
>>> LoggerPtr logger =
>>>Logger::getLogger(_T("RALtest"));
>>>
>>> int main(int argc, char* argv[])
>>> {
>>> int result = EXIT_SUCCESS;
>>> try
>>> {
>>> if (argc > 1)
>>> {
>>> USES_CONVERSION;
>>> String propertyFileName = argv[1];
>>>
>>>PropertyConfigurator::configure(propertyFileName);
>>> }
>>> else
>>> {
>>> BasicConfigurator::configure();
>>> }
>>>
>>> logger->info(_T("Entering RALtest
>>>application."));
>>> ....
>>>
>>> Lars
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> __________________________________
>>> Do you Yahoo!?
>>> Yahoo! Domains - Claim yours for only
>>>$14.70/year
>>> http://smallbusiness.promotions.yahoo.com/offer
>>>
>>>
>>>
>>>
>>>
>>--------------------------------------------------------------------------
>>
>>
>----
>
>
>>> Do you Yahoo!?
>>> Yahoo! Domains - Claim yours for only $14.70/year
>>>
>>>
>>
>>
>>
>>__________________________________
>>Do you Yahoo!?
>>Yahoo! Domains - Claim yours for only $14.70/year
>>http://smallbusiness.promotions.yahoo.com/offer
>>
>>
>
>
>
>
>
---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
Re: You have tried to set a null level to root.
Posted by Michaël CATANZARITI <mc...@free.fr>.
Hello,
It seems the problem is related to the construction order of static
variables.
Visual C++ 7.1, constructs static variables in the declaration order for
each source file, and in the link order of each obj file and library for
a whole module.
So, the static variable used in the delayedloop example is constructed
before the static variables declared in log4cxxs.lib (for the linker
parse delayedloop.obj first).
Accordingly, the static variables concerning levels, implemented in
level.cpp are initialized later. This is was the rootLogger level seems
not to be set.
Please add the following lines on top of the files level.cpp and
logmanager.cpp :
// Force initialization early.
#pragma warning(disable: 4074)
#pragma warning(disable: 4073)
#pragma init_seg(lib)
The directive '#pragma init_seg(lib)' permits to force the static variables implemented in its scope to be initialized first.
Michaël
Lennart Goedhart wrote:
>Yeah, I have the same problem if I try to use the static log4cxx library.
>It's dumping at the point it's trying to assign the static Bar::logger.
>It works fine if you use the log4cxx.lib (therefore the dll).
>As to why this is the case, that's a question for one of the log4cxx
>developers, I guess.
>
>----- Original Message -----
>From: "Lars Schouw" <sc...@yahoo.com>
>To: "Log4CXX User" <lo...@logging.apache.org>
>Sent: Thursday, May 20, 2004 7:32 PM
>Subject: Re: You have tried to set a null level to root.
>
>
>
>
>>Lennart
>>
>>You are really a great help thank for always answering
>>so quick!
>>
>>It dumps before that it even gets to there!
>>
>>I took out the A2W here A2W(argv[1]); as well since
>>since my code is not unicode.
>>
>>I pass the following into the program as a startup
>>argument. config/LogSettings.txt
>>
>>Well I have this configuration file called
>>LogSettings.txt
>>
>># Set root logger level to DEBUG and its only appender
>>to A1.
>>log4j.rootLogger=DEBUG, A1
>>
>># A1 is set to be a ConsoleAppender.
>>log4j.appender.A1=org.apache.log4j.ConsoleAppender
>>
>># A1 uses PatternLayout.
>>log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>>log4j.appender.A1.layout.ConversionPattern=%d [%t]
>>%-5p %c %x - %m (F:L)%n
>>
>>Also in the meanwhile I tried to setup the trivial
>>project replacing the code with the bar sample you
>>have in the documentation.
>>When I run it I get an error like before
>>You have tried to set a null level to root.
>>and in this case it runs down the sample code until
>>this line is called:
>>logger->info(_T("Entering application."));
>>where an exception is thrown.
>>In the console I get this.
>>First-chance exception at 0x77e73887 in trivial.exe:
>>Microsoft C++ exception:
>>log4cxx::helpers::RuntimeException @ 0x0012fddc.
>>Please be awair the the code is not the trivial.cpp
>>from your sample but the code from the documentation.
>>
>>Again I am using the static library I compiled myself.
>>
>>Also one more thing when I build I get some warnings.
>>They come from an error in the documentation;
>>#include <log4cxx/logger.h>;
>>Should be without the last semicolon.
>>
>>
>>
>>
>>Regards
>>Lars Schouw
>>
>>--- Lennart Goedhart <le...@omnibase.com.au> wrote:
>>
>>
>>>I assume you get this when you pass the arg of the
>>>config file. What does your config file look like?
>>>When I comile that snippet of your code (with a few
>>>minor changes), it works fine.
>>>I have he logfile I pass working with Conole,
>>>RollingFile and ODBC appenders...
>>> ----- Original Message -----
>>> From: Lars Schouw
>>> To: Log4CXX User
>>> Sent: Thursday, May 20, 2004 5:23 PM
>>> Subject: Re: You have tried to set a null level to
>>>root.
>>>
>>>
>>> Sorry forgot to tell that I also have a static
>>>variable declared in a header file
>>> static log4cxx::LoggerPtr logger;
>>>
>>>
>>>
>>> Lars Schouw <sc...@yahoo.com> wrote:
>>> I tried to add a configuration file to my
>>>project but
>>> when I run it I get this error:
>>> You have tried to set a null level to root.
>>> and an exception it thrown.
>>> This is before I even hit the main function so
>>>it must
>>> belong to the static variable I declared the is
>>> initialized when the object is loaded.
>>>
>>> My souce code:
>>>
>>> // include log4cxx header files.
>>> #include
>>> #include
>>> #include
>>> #include
>>>
>>> using namespace log4cxx;
>>> using namespace log4cxx::helpers;
>>>
>>> // Define a static logger variable so that it
>>> references the logger instance named "RALtest".
>>> LoggerPtr logger =
>>>Logger::getLogger(_T("RALtest"));
>>>
>>> int main(int argc, char* argv[])
>>> {
>>> int result = EXIT_SUCCESS;
>>> try
>>> {
>>> if (argc > 1)
>>> {
>>> USES_CONVERSION;
>>> String propertyFileName = argv[1];
>>>
>>>PropertyConfigurator::configure(propertyFileName);
>>> }
>>> else
>>> {
>>> BasicConfigurator::configure();
>>> }
>>>
>>> logger->info(_T("Entering RALtest
>>>application."));
>>> ....
>>>
>>> Lars
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> __________________________________
>>> Do you Yahoo!?
>>> Yahoo! Domains - Claim yours for only
>>>$14.70/year
>>> http://smallbusiness.promotions.yahoo.com/offer
>>>
>>>
>>>
>>>
>>>
>>--------------------------------------------------------------------------
>>
>>
>----
>
>
>>> Do you Yahoo!?
>>> Yahoo! Domains - Claim yours for only $14.70/year
>>>
>>>
>>
>>
>>
>>__________________________________
>>Do you Yahoo!?
>>Yahoo! Domains - Claim yours for only $14.70/year
>>http://smallbusiness.promotions.yahoo.com/offer
>>
>>
>
>
>
>
>
Re: You have tried to set a null level to root.
Posted by Lennart Goedhart <le...@omnibase.com.au>.
Yeah, I have the same problem if I try to use the static log4cxx library.
It's dumping at the point it's trying to assign the static Bar::logger.
It works fine if you use the log4cxx.lib (therefore the dll).
As to why this is the case, that's a question for one of the log4cxx
developers, I guess.
----- Original Message -----
From: "Lars Schouw" <sc...@yahoo.com>
To: "Log4CXX User" <lo...@logging.apache.org>
Sent: Thursday, May 20, 2004 7:32 PM
Subject: Re: You have tried to set a null level to root.
> Lennart
>
> You are really a great help thank for always answering
> so quick!
>
> It dumps before that it even gets to there!
>
> I took out the A2W here A2W(argv[1]); as well since
> since my code is not unicode.
>
> I pass the following into the program as a startup
> argument. config/LogSettings.txt
>
> Well I have this configuration file called
> LogSettings.txt
>
> # Set root logger level to DEBUG and its only appender
> to A1.
> log4j.rootLogger=DEBUG, A1
>
> # A1 is set to be a ConsoleAppender.
> log4j.appender.A1=org.apache.log4j.ConsoleAppender
>
> # A1 uses PatternLayout.
> log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> log4j.appender.A1.layout.ConversionPattern=%d [%t]
> %-5p %c %x - %m (F:L)%n
>
> Also in the meanwhile I tried to setup the trivial
> project replacing the code with the bar sample you
> have in the documentation.
> When I run it I get an error like before
> You have tried to set a null level to root.
> and in this case it runs down the sample code until
> this line is called:
> logger->info(_T("Entering application."));
> where an exception is thrown.
> In the console I get this.
> First-chance exception at 0x77e73887 in trivial.exe:
> Microsoft C++ exception:
> log4cxx::helpers::RuntimeException @ 0x0012fddc.
> Please be awair the the code is not the trivial.cpp
> from your sample but the code from the documentation.
>
> Again I am using the static library I compiled myself.
>
> Also one more thing when I build I get some warnings.
> They come from an error in the documentation;
> #include <log4cxx/logger.h>;
> Should be without the last semicolon.
>
>
>
>
> Regards
> Lars Schouw
>
> --- Lennart Goedhart <le...@omnibase.com.au> wrote:
> > I assume you get this when you pass the arg of the
> > config file. What does your config file look like?
> > When I comile that snippet of your code (with a few
> > minor changes), it works fine.
> > I have he logfile I pass working with Conole,
> > RollingFile and ODBC appenders...
> > ----- Original Message -----
> > From: Lars Schouw
> > To: Log4CXX User
> > Sent: Thursday, May 20, 2004 5:23 PM
> > Subject: Re: You have tried to set a null level to
> > root.
> >
> >
> > Sorry forgot to tell that I also have a static
> > variable declared in a header file
> > static log4cxx::LoggerPtr logger;
> >
> >
> >
> > Lars Schouw <sc...@yahoo.com> wrote:
> > I tried to add a configuration file to my
> > project but
> > when I run it I get this error:
> > You have tried to set a null level to root.
> > and an exception it thrown.
> > This is before I even hit the main function so
> > it must
> > belong to the static variable I declared the is
> > initialized when the object is loaded.
> >
> > My souce code:
> >
> > // include log4cxx header files.
> > #include
> > #include
> > #include
> > #include
> >
> > using namespace log4cxx;
> > using namespace log4cxx::helpers;
> >
> > // Define a static logger variable so that it
> > references the logger instance named "RALtest".
> > LoggerPtr logger =
> > Logger::getLogger(_T("RALtest"));
> >
> > int main(int argc, char* argv[])
> > {
> > int result = EXIT_SUCCESS;
> > try
> > {
> > if (argc > 1)
> > {
> > USES_CONVERSION;
> > String propertyFileName = argv[1];
> >
> > PropertyConfigurator::configure(propertyFileName);
> > }
> > else
> > {
> > BasicConfigurator::configure();
> > }
> >
> > logger->info(_T("Entering RALtest
> > application."));
> > ....
> >
> > Lars
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Domains - Claim yours for only
> > $14.70/year
> > http://smallbusiness.promotions.yahoo.com/offer
> >
> >
> >
> --------------------------------------------------------------------------
----
> > Do you Yahoo!?
> > Yahoo! Domains - Claim yours for only $14.70/year
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Domains - Claim yours for only $14.70/year
> http://smallbusiness.promotions.yahoo.com/offer
Re: You have tried to set a null level to root.
Posted by Lars Schouw <sc...@yahoo.com>.
Lennart
You are really a great help thank for always answering
so quick!
It dumps before that it even gets to there!
I took out the A2W here A2W(argv[1]); as well since
since my code is not unicode.
I pass the following into the program as a startup
argument. config/LogSettings.txt
Well I have this configuration file called
LogSettings.txt
# Set root logger level to DEBUG and its only appender
to A1.
log4j.rootLogger=DEBUG, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%t]
%-5p %c %x - %m (F:L)%n
Also in the meanwhile I tried to setup the trivial
project replacing the code with the bar sample you
have in the documentation.
When I run it I get an error like before
You have tried to set a null level to root.
and in this case it runs down the sample code until
this line is called:
logger->info(_T("Entering application."));
where an exception is thrown.
In the console I get this.
First-chance exception at 0x77e73887 in trivial.exe:
Microsoft C++ exception:
log4cxx::helpers::RuntimeException @ 0x0012fddc.
Please be awair the the code is not the trivial.cpp
from your sample but the code from the documentation.
Again I am using the static library I compiled myself.
Also one more thing when I build I get some warnings.
They come from an error in the documentation;
#include <log4cxx/logger.h>;
Should be without the last semicolon.
Regards
Lars Schouw
--- Lennart Goedhart <le...@omnibase.com.au> wrote:
> I assume you get this when you pass the arg of the
> config file. What does your config file look like?
> When I comile that snippet of your code (with a few
> minor changes), it works fine.
> I have he logfile I pass working with Conole,
> RollingFile and ODBC appenders...
> ----- Original Message -----
> From: Lars Schouw
> To: Log4CXX User
> Sent: Thursday, May 20, 2004 5:23 PM
> Subject: Re: You have tried to set a null level to
> root.
>
>
> Sorry forgot to tell that I also have a static
> variable declared in a header file
> static log4cxx::LoggerPtr logger;
>
>
>
> Lars Schouw <sc...@yahoo.com> wrote:
> I tried to add a configuration file to my
> project but
> when I run it I get this error:
> You have tried to set a null level to root.
> and an exception it thrown.
> This is before I even hit the main function so
> it must
> belong to the static variable I declared the is
> initialized when the object is loaded.
>
> My souce code:
>
> // include log4cxx header files.
> #include
> #include
> #include
> #include
>
> using namespace log4cxx;
> using namespace log4cxx::helpers;
>
> // Define a static logger variable so that it
> references the logger instance named "RALtest".
> LoggerPtr logger =
> Logger::getLogger(_T("RALtest"));
>
> int main(int argc, char* argv[])
> {
> int result = EXIT_SUCCESS;
> try
> {
> if (argc > 1)
> {
> USES_CONVERSION;
> String propertyFileName = argv[1];
>
> PropertyConfigurator::configure(propertyFileName);
> }
> else
> {
> BasicConfigurator::configure();
> }
>
> logger->info(_T("Entering RALtest
> application."));
> ....
>
> Lars
>
>
>
>
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Domains - Claim yours for only
> $14.70/year
> http://smallbusiness.promotions.yahoo.com/offer
>
>
>
------------------------------------------------------------------------------
> Do you Yahoo!?
> Yahoo! Domains - Claim yours for only $14.70/year
__________________________________
Do you Yahoo!?
Yahoo! Domains � Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer
Re: You have tried to set a null level to root.
Posted by Lennart Goedhart <le...@omnibase.com.au>.
I assume you get this when you pass the arg of the config file. What does your config file look like?
When I comile that snippet of your code (with a few minor changes), it works fine.
I have he logfile I pass working with Conole, RollingFile and ODBC appenders...
----- Original Message -----
From: Lars Schouw
To: Log4CXX User
Sent: Thursday, May 20, 2004 5:23 PM
Subject: Re: You have tried to set a null level to root.
Sorry forgot to tell that I also have a static variable declared in a header file
static log4cxx::LoggerPtr logger;
Lars Schouw <sc...@yahoo.com> wrote:
I tried to add a configuration file to my project but
when I run it I get this error:
You have tried to set a null level to root.
and an exception it thrown.
This is before I even hit the main function so it must
belong to the static variable I declared the is
initialized when the object is loaded.
My souce code:
// include log4cxx header files.
#include
#include
#include
#include
using namespace log4cxx;
using namespace log4cxx::helpers;
// Define a static logger variable so that it
references the logger instance named "RALtest".
LoggerPtr logger = Logger::getLogger(_T("RALtest"));
int main(int argc, char* argv[])
{
int result = EXIT_SUCCESS;
try
{
if (argc > 1)
{
USES_CONVERSION;
String propertyFileName = argv[1];
PropertyConfigurator::configure(propertyFileName);
}
else
{
BasicConfigurator::configure();
}
logger->info(_T("Entering RALtest application."));
....
Lars
__________________________________
Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer
------------------------------------------------------------------------------
Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year
Re: You have tried to set a null level to root.
Posted by Lars Schouw <sc...@yahoo.com>.
Sorry forgot to tell that I also have a static variable declared in a header file
static log4cxx::LoggerPtr logger;
Lars Schouw <sc...@yahoo.com> wrote:
I tried to add a configuration file to my project but
when I run it I get this error:
You have tried to set a null level to root.
and an exception it thrown.
This is before I even hit the main function so it must
belong to the static variable I declared the is
initialized when the object is loaded.
My souce code:
// include log4cxx header files.
#include
#include
#include
#include
using namespace log4cxx;
using namespace log4cxx::helpers;
// Define a static logger variable so that it
references the logger instance named "RALtest".
LoggerPtr logger = Logger::getLogger(_T("RALtest"));
int main(int argc, char* argv[])
{
int result = EXIT_SUCCESS;
try
{
if (argc > 1)
{
USES_CONVERSION;
String propertyFileName = argv[1];
PropertyConfigurator::configure(propertyFileName);
}
else
{
BasicConfigurator::configure();
}
logger->info(_T("Entering RALtest application."));
....
Lars
__________________________________
Do you Yahoo!?
Yahoo! Domains � Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer
---------------------------------
Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year
You have tried to set a null level to root.
Posted by Lars Schouw <sc...@yahoo.com>.
I tried to add a configuration file to my project but
when I run it I get this error:
You have tried to set a null level to root.
and an exception it thrown.
This is before I even hit the main function so it must
belong to the static variable I declared the is
initialized when the object is loaded.
My souce code:
// include log4cxx header files.
#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>
#include <log4cxx/propertyconfigurator.h>
#include <log4cxx/helpers/exception.h>
using namespace log4cxx;
using namespace log4cxx::helpers;
// Define a static logger variable so that it
references the logger instance named "RALtest".
LoggerPtr logger = Logger::getLogger(_T("RALtest"));
int main(int argc, char* argv[])
{
int result = EXIT_SUCCESS;
try
{
if (argc > 1)
{
USES_CONVERSION;
String propertyFileName = argv[1];
PropertyConfigurator::configure(propertyFileName);
}
else
{
BasicConfigurator::configure();
}
logger->info(_T("Entering RALtest application."));
....
Lars
__________________________________
Do you Yahoo!?
Yahoo! Domains � Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer
Re: 64bit warnings under VC7.1
Posted by Lennart Goedhart <le...@omnibase.com.au>.
Under the project's Configuration Properties->C/C++->General:
Set "Detect 64-bit Portability Issues" to "No"
Lennart
----- Original Message -----
From: "Lars Schouw" <sc...@yahoo.com>
To: "Log4CXX User" <lo...@logging.apache.org>
Sent: Thursday, May 20, 2004 4:41 PM
Subject: 64bit warnings under VC7.1
> Is there any way we can get ride of these warnings?
>
> ..\3rdparty\log4cxx\0.9.7\include\log4cxx\helpers\tchar.h(263)
> : warning C4244: 'argument' : conversion from '__w64
> int' to 'std::streamoff', possible loss of data
> ..\3rdparty\log4cxx\0.9.7\include\log4cxx\helpers\tchar.h(264)
> : warning C4244: 'argument' : conversion from '__w64
> int' to 'int', possible loss of data
> ..\3rdparty\log4cxx\0.9.7\include\log4cxx\helpers\tchar.h(269)
> : warning C4244: 'argument' : conversion from '__w64
> int' to 'std::streamoff', possible loss of data
>
> Regards
> Lars Schouw
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Domains - Claim yours for only $14.70/year
> http://smallbusiness.promotions.yahoo.com/offer
64bit warnings under VC7.1
Posted by Lars Schouw <sc...@yahoo.com>.
Is there any way we can get ride of these warnings?
..\3rdparty\log4cxx\0.9.7\include\log4cxx\helpers\tchar.h(263)
: warning C4244: 'argument' : conversion from '__w64
int' to 'std::streamoff', possible loss of data
..\3rdparty\log4cxx\0.9.7\include\log4cxx\helpers\tchar.h(264)
: warning C4244: 'argument' : conversion from '__w64
int' to 'int', possible loss of data
..\3rdparty\log4cxx\0.9.7\include\log4cxx\helpers\tchar.h(269)
: warning C4244: 'argument' : conversion from '__w64
int' to 'std::streamoff', possible loss of data
Regards
Lars Schouw
__________________________________
Do you Yahoo!?
Yahoo! Domains � Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer
Re: Linking static libs under VC7.1 does not work
Posted by Lars Schouw <sc...@yahoo.com>.
Works now.
Thanks ;)
---------------------------------
Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year
Re: Linking static libs under VC7.1 does not work
Posted by Lennart Goedhart <le...@omnibase.com.au>.
I meant using the "Static Debug" Configuration when you build the trivial
application. It has the settings to work with a static log4cxx library.
Effectively it does this:
- Set the LOG4CXX_STATIC definition in the Preprocessor Definitions (which,
when missing will give you the __declspec(dllimport) errors. log4cxx.lib
uses the dll by default)
- Set the library dependency to "log4cxxs.lib"
- For trivial to link, you will also need to add the following to the
library dependency: Ws2_32.lib (winsock).
----- Original Message -----
From: "Lars Schouw" <sc...@yahoo.com>
To: "Log4CXX User" <lo...@logging.apache.org>
Sent: Thursday, May 20, 2004 11:27 AM
Subject: Re: Linking static libs under VC7.1 does not work
> Lennart
>
> I just tried again rebuilding the static lib in debug
> mode linking it into the trivial application.
> I still get the same error.
>
> I checked the settings again. I am suspecting that it
> does not know the __declspec(dllimport) stuff.
> Is there any place in the trivial project where this
> has been defined to use dll?
> The defines are these: WIN32;_DEBUG;_CONSOLE
> which looks harmless to me.
>
> Build Log ------- Build started: Project:
> trivial, Configuration: Debug|Win32 -------
>
> Command Lines Creating temporary file
> "c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\RSP000004.rsp"
> with contents
> [
> /OUT:"../Bin/Debug/trivial.exe" /INCREMENTAL:NO
> /NOLOGO
> /LIBPATH:"C:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\lib\debug"
> /DEBUG /PDB:".\Debug/trivial.pdb" /SUBSYSTEM:CONSOLE
> /MACHINE:X86 log4cxxs.lib kernel32.lib user32.lib
> gdi32.lib winspool.lib comdlg32.lib advapi32.lib
> shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
> odbccp32.lib
> "\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\lib\debug\log4cxxs.lib"
> ".\Debug\trivial.obj"
> ]
> Creating command line "link.exe
>
@"c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\RSP000004.rsp""
> Output Window Linking...
> LINK : warning LNK4075: ignoring '/EDITANDCONTINUE'
> due to '/INCREMENTAL:NO' specification
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: void __thiscall
> log4cxx::Logger::fatal(class std::basic_string,class
> std::allocator > const &,char const *,int)"
>
(__imp_?fatal@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V
?$allocator@D@2@@std@@PBDH@Z)
> referenced in function _main
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: void __thiscall
> log4cxx::Logger::error(class std::basic_string,class
> std::allocator > const &,char const *,int)"
>
(__imp_?error@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V
?$allocator@D@2@@std@@PBDH@Z)
> referenced in function _main
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: void __thiscall
> log4cxx::Logger::warn(class std::basic_string,class
> std::allocator > const &,char const *,int)"
>
(__imp_?warn@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?
$allocator@D@2@@std@@PBDH@Z)
> referenced in function _main
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: void __thiscall
> log4cxx::Logger::info(class std::basic_string,class
> std::allocator > const &,char const *,int)"
>
(__imp_?info@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?
$allocator@D@2@@std@@PBDH@Z)
> referenced in function _main
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: void __thiscall
> log4cxx::Logger::debug(class std::basic_string,class
> std::allocator > const &,char const *,int)"
>
(__imp_?debug@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V
?$allocator@D@2@@std@@PBDH@Z)
> referenced in function _main
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: static void
> __cdecl log4cxx::NDC::push(class
> std::basic_string,class std::allocator > const &)"
>
(__imp_?push@NDC@log4cxx@@SAXABV?$basic_string@DU?$char_traits@D@std@@V?$all
ocator@D@2@@std@@@Z)
> referenced in function _main
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: static class
> log4cxx::helpers::ObjectPtrT __cdecl
> log4cxx::Logger::getRootLogger(void)"
>
(__imp_?getRootLogger@Logger@log4cxx@@SA?AV?$ObjectPtrT@VLogger@log4cxx@@@he
lpers@2@XZ)
> referenced in function _main
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: static void
> __cdecl log4cxx::BasicConfigurator::configure(void)"
> (__imp_?configure@BasicConfigurator@log4cxx@@SAXXZ)
> referenced in function _main
> ../Bin/Debug/trivial.exe : fatal error LNK1120: 8
> unresolved externals
> Results Build log was saved at
>
"file://c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\BuildLog.h
tm"
> trivial - 9 error(s), 1 warning(s)
>
> Lars Schouw
> Tokyo
>
> --- Lennart Goedhart <le...@omnibase.com.au> wrote:
> > I just tried them (I have VC7.1 also), and it worked
> > fine.
> > Are you selecting the "Static Debug" Configuration
> > when you build?
> > ----- Original Message -----
> > From: Lars Schouw
> > To: Log4CXX User
> > Sent: Wednesday, May 19, 2004 5:36 PM
> > Subject: Linking static libs under VC7.1 does not
> > work
> >
> >
> > I just tried to link the trivial example project
> > with the static build library log4cxxs.lib but get a
> > link error.
> >
> > I am using log4cxx version 0.9.7.
> >
> > Any ideas? I want to use the static library in
> > my real application.
> >
> > ------ Build started: Project: trivial,
> > Configuration: Debug Win32 ------
> >
> > Linking...
> >
> > LINK : warning LNK4075: ignoring
> > '/EDITANDCONTINUE' due to '/INCREMENTAL:NO'
> > specification
> >
> > trivial.obj : error LNK2019: unresolved external
> > symbol "__declspec(dllimport) public: void
> > __thiscall log4cxx::Logger::fatal(class
> > std::basic_string<char,struct
> > std::char_traits<char>,class std::allocator<char> >
> > const &,char const *,int)"
> >
>
(__imp_?fatal@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V
?$allocator@D@2@@std@@PBDH@Z)
> > referenced in function _main
> >
> > trivial.obj : error LNK2019: unresolved external
> > symbol "__declspec(dllimport) public: void
> > __thiscall log4cxx::Logger::error(class
> > std::basic_string<char,struct
> > std::char_traits<char>,class std::allocator<char> >
> > const &,char const *,int)"
> >
>
(__imp_?error@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V
?$allocator@D@2@@std@@PBDH@Z)
> > referenced in function _main
> >
> > trivial.obj : error LNK2019: unresolved external
> > symbol "__declspec(dllimport) public: void
> > __thiscall log4cxx::Logger::warn(class
> > std::basic_string<char,struct
> > std::char_traits<char>,class std::allocator<char> >
> > const &,char const *,int)"
> >
>
(__imp_?warn@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?
$allocator@D@2@@std@@PBDH@Z)
> > referenced in function _main
> >
> > trivial.obj : error LNK2019: unresolved external
> > symbol "__declspec(dllimport) public: void
> > __thiscall log4cxx::Logger::info(class
> > std::basic_string<char,struct
> > std::char_traits<char>,class std::allocator<char> >
> > const &,char const *,int)"
> >
>
(__imp_?info@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?
$allocator@D@2@@std@@PBDH@Z)
> > referenced in function _main
> >
> > trivial.obj : error LNK2019: unresolved external
> > symbol "__declspec(dllimport) public: void
> > __thiscall log4cxx::Logger::debug(class
> > std::basic_string<char,struct
> > std::char_traits<char>,class std::allocator<char> >
> > const &,char const *,int)"
> >
>
(__imp_?debug@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V
?$allocator@D@2@@std@@PBDH@Z)
> > referenced in function _main
> >
> > trivial.obj : error LNK2019: unresolved external
> > symbol "__declspec(dllimport) public: static void
> > __cdecl log4cxx::NDC::push(class
> > std::basic_string<char,struct
> > std::char_traits<char>,class std::allocator<char> >
> > const &)"
> >
>
(__imp_?push@NDC@log4cxx@@SAXABV?$basic_string@DU?$char_traits@D@std@@V?$all
ocator@D@2@@std@@@Z)
> > referenced in function _main
> >
> > trivial.obj : error LNK2019: unresolved external
> > symbol "__declspec(dllimport) public: static class
> > log4cxx::helpers::ObjectPtrT<class log4cxx::Logger>
> > __cdecl log4cxx::Logger::getRootLogger(void)"
> >
>
(__imp_?getRootLogger@Logger@log4cxx@@SA?AV?$ObjectPtrT@VLogger@log4cxx@@@he
lpers@2@XZ)
> > referenced in function _main
> >
> > trivial.obj : error LNK2019: unresolved external
> > symbol "__declspec(dllimport) public: static void
> > __cdecl log4cxx::BasicConfigurator::configure(void)"
> > (__imp_?configure@BasicConfigurator@log4cxx@@SAXXZ)
> > referenced in function _main
> >
> > ../Bin/Debug/trivial.exe : fatal error LNK1120:
> > 8 unresolved externals
> >
> > Build log was saved at
> >
>
"file://c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\BuildLog.h
tm"
> >
> > trivial - 9 error(s), 1 warning(s)
> >
> >
> >
> >
> --------------------------------------------------------------------------
----
> > Do you Yahoo!?
> > SBC Yahoo! - Internet access at a great low price.
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Domains - Claim yours for only $14.70/year
> http://smallbusiness.promotions.yahoo.com/offer
Re: Linking static libs under VC7.1 does not work
Posted by Lars Schouw <sc...@yahoo.com>.
Lennart
I just tried again rebuilding the static lib in debug
mode linking it into the trivial application.
I still get the same error.
I checked the settings again. I am suspecting that it
does not know the __declspec(dllimport) stuff.
Is there any place in the trivial project where this
has been defined to use dll?
The defines are these: WIN32;_DEBUG;_CONSOLE
which looks harmless to me.
Build Log ------- Build started: Project:
trivial, Configuration: Debug|Win32 -------
Command Lines Creating temporary file
"c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\RSP000004.rsp"
with contents
[
/OUT:"../Bin/Debug/trivial.exe" /INCREMENTAL:NO
/NOLOGO
/LIBPATH:"C:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\lib\debug"
/DEBUG /PDB:".\Debug/trivial.pdb" /SUBSYSTEM:CONSOLE
/MACHINE:X86 log4cxxs.lib kernel32.lib user32.lib
gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib
"\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\lib\debug\log4cxxs.lib"
".\Debug\trivial.obj"
]
Creating command line "link.exe
@"c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\RSP000004.rsp""
Output Window Linking...
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE'
due to '/INCREMENTAL:NO' specification
trivial.obj : error LNK2019: unresolved external
symbol "__declspec(dllimport) public: void __thiscall
log4cxx::Logger::fatal(class std::basic_string,class
std::allocator > const &,char const *,int)"
(__imp_?fatal@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)
referenced in function _main
trivial.obj : error LNK2019: unresolved external
symbol "__declspec(dllimport) public: void __thiscall
log4cxx::Logger::error(class std::basic_string,class
std::allocator > const &,char const *,int)"
(__imp_?error@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)
referenced in function _main
trivial.obj : error LNK2019: unresolved external
symbol "__declspec(dllimport) public: void __thiscall
log4cxx::Logger::warn(class std::basic_string,class
std::allocator > const &,char const *,int)"
(__imp_?warn@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)
referenced in function _main
trivial.obj : error LNK2019: unresolved external
symbol "__declspec(dllimport) public: void __thiscall
log4cxx::Logger::info(class std::basic_string,class
std::allocator > const &,char const *,int)"
(__imp_?info@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)
referenced in function _main
trivial.obj : error LNK2019: unresolved external
symbol "__declspec(dllimport) public: void __thiscall
log4cxx::Logger::debug(class std::basic_string,class
std::allocator > const &,char const *,int)"
(__imp_?debug@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)
referenced in function _main
trivial.obj : error LNK2019: unresolved external
symbol "__declspec(dllimport) public: static void
__cdecl log4cxx::NDC::push(class
std::basic_string,class std::allocator > const &)"
(__imp_?push@NDC@log4cxx@@SAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
referenced in function _main
trivial.obj : error LNK2019: unresolved external
symbol "__declspec(dllimport) public: static class
log4cxx::helpers::ObjectPtrT __cdecl
log4cxx::Logger::getRootLogger(void)"
(__imp_?getRootLogger@Logger@log4cxx@@SA?AV?$ObjectPtrT@VLogger@log4cxx@@@helpers@2@XZ)
referenced in function _main
trivial.obj : error LNK2019: unresolved external
symbol "__declspec(dllimport) public: static void
__cdecl log4cxx::BasicConfigurator::configure(void)"
(__imp_?configure@BasicConfigurator@log4cxx@@SAXXZ)
referenced in function _main
../Bin/Debug/trivial.exe : fatal error LNK1120: 8
unresolved externals
Results Build log was saved at
"file://c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\BuildLog.htm"
trivial - 9 error(s), 1 warning(s)
Lars Schouw
Tokyo
--- Lennart Goedhart <le...@omnibase.com.au> wrote:
> I just tried them (I have VC7.1 also), and it worked
> fine.
> Are you selecting the "Static Debug" Configuration
> when you build?
> ----- Original Message -----
> From: Lars Schouw
> To: Log4CXX User
> Sent: Wednesday, May 19, 2004 5:36 PM
> Subject: Linking static libs under VC7.1 does not
> work
>
>
> I just tried to link the trivial example project
> with the static build library log4cxxs.lib but get a
> link error.
>
> I am using log4cxx version 0.9.7.
>
> Any ideas? I want to use the static library in
> my real application.
>
> ------ Build started: Project: trivial,
> Configuration: Debug Win32 ------
>
> Linking...
>
> LINK : warning LNK4075: ignoring
> '/EDITANDCONTINUE' due to '/INCREMENTAL:NO'
> specification
>
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: void
> __thiscall log4cxx::Logger::fatal(class
> std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >
> const &,char const *,int)"
>
(__imp_?fatal@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)
> referenced in function _main
>
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: void
> __thiscall log4cxx::Logger::error(class
> std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >
> const &,char const *,int)"
>
(__imp_?error@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)
> referenced in function _main
>
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: void
> __thiscall log4cxx::Logger::warn(class
> std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >
> const &,char const *,int)"
>
(__imp_?warn@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)
> referenced in function _main
>
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: void
> __thiscall log4cxx::Logger::info(class
> std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >
> const &,char const *,int)"
>
(__imp_?info@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)
> referenced in function _main
>
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: void
> __thiscall log4cxx::Logger::debug(class
> std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >
> const &,char const *,int)"
>
(__imp_?debug@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z)
> referenced in function _main
>
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: static void
> __cdecl log4cxx::NDC::push(class
> std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >
> const &)"
>
(__imp_?push@NDC@log4cxx@@SAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
> referenced in function _main
>
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: static class
> log4cxx::helpers::ObjectPtrT<class log4cxx::Logger>
> __cdecl log4cxx::Logger::getRootLogger(void)"
>
(__imp_?getRootLogger@Logger@log4cxx@@SA?AV?$ObjectPtrT@VLogger@log4cxx@@@helpers@2@XZ)
> referenced in function _main
>
> trivial.obj : error LNK2019: unresolved external
> symbol "__declspec(dllimport) public: static void
> __cdecl log4cxx::BasicConfigurator::configure(void)"
> (__imp_?configure@BasicConfigurator@log4cxx@@SAXXZ)
> referenced in function _main
>
> ../Bin/Debug/trivial.exe : fatal error LNK1120:
> 8 unresolved externals
>
> Build log was saved at
>
"file://c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\BuildLog.htm"
>
> trivial - 9 error(s), 1 warning(s)
>
>
>
>
------------------------------------------------------------------------------
> Do you Yahoo!?
> SBC Yahoo! - Internet access at a great low price.
__________________________________
Do you Yahoo!?
Yahoo! Domains � Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer
Re: Linking static libs under VC7.1 does not work
Posted by Lennart Goedhart <le...@omnibase.com.au>.
I just tried them (I have VC7.1 also), and it worked fine.
Are you selecting the "Static Debug" Configuration when you build?
----- Original Message -----
From: Lars Schouw
To: Log4CXX User
Sent: Wednesday, May 19, 2004 5:36 PM
Subject: Linking static libs under VC7.1 does not work
I just tried to link the trivial example project with the static build library log4cxxs.lib but get a link error.
I am using log4cxx version 0.9.7.
Any ideas? I want to use the static library in my real application.
------ Build started: Project: trivial, Configuration: Debug Win32 ------
Linking...
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall log4cxx::Logger::fatal(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *,int)" (__imp_?fatal@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall log4cxx::Logger::error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *,int)" (__imp_?error@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall log4cxx::Logger::warn(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *,int)" (__imp_?warn@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall log4cxx::Logger::info(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *,int)" (__imp_?info@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall log4cxx::Logger::debug(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *,int)" (__imp_?debug@Logger@log4cxx@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDH@Z) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl log4cxx::NDC::push(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?push@NDC@log4cxx@@SAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class log4cxx::helpers::ObjectPtrT<class log4cxx::Logger> __cdecl log4cxx::Logger::getRootLogger(void)" (__imp_?getRootLogger@Logger@log4cxx@@SA?AV?$ObjectPtrT@VLogger@log4cxx@@@helpers@2@XZ) referenced in function _main
trivial.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl log4cxx::BasicConfigurator::configure(void)" (__imp_?configure@BasicConfigurator@log4cxx@@SAXXZ) referenced in function _main
../Bin/Debug/trivial.exe : fatal error LNK1120: 8 unresolved externals
Build log was saved at "file://c:\sletmig\log4cxx0.9.7\log4cxx-0.9.7\msvc\examples\Debug\BuildLog.htm"
trivial - 9 error(s), 1 warning(s)
------------------------------------------------------------------------------
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.