Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2005-11-09 16:01:43


>
>
> | - get started by using one of the examples provided by the library.
> | You could start with the 'basic_usage' example, or
>
>
> | - include the source files into your projects -
> | it's just 3 source files,
>
> log_manager.cpp
> log.cpp
> functions.cpp
>
> #define BOOST_LOG_NO_LIB
>
> sounds good ...
>
> BUT
>
> i:\boost_root\libs\log\src\functions.cpp(53) : error C2664:
> 'OutputDebugStringW' : cannot convert parameter 1 from 'const char *' to
> 'LPCWSTR'
>
> Adding a (LPCWSTR) makes this compile and link OK.
>
> But then re-compile your \examples\simple example fails to compile
>
> functions.cpp
> ..\..\..\src\functions.cpp(53) : error C2664: 'OutputDebugStringA' : cannot
> convert parameter 1 from 'LPCWSTR' to 'LPCSTR'
> Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
>
> So I tried (LPCSTR) (quickest bodge) and with autorun works thus:

I've made it work for Unicode, and tested in on VC7.1: the basic_usage
example now has a configuration called "Debug Unicode"

>
> UNC paths are not supported. <<<<<<<<<<<<<<<<< Why not?

How should I know? :)

> Defaulting to Windows directory.
> 17:44:00 [app] [Thread 2188] pre-start - this gets logged too!
> 17:44:00 [app.dbg] debug pre-start - this gets logged too!
> 17:44:00 [app] [Thread 2188] testing1-2-3
> 17:44:00 [app.dbg] this is a debug message, i=1
> 17:44:00 I just wanted to tell you something....
> 17:44:00 [app.warn] Logged-on Users approach max. limit
> 17:44:00 [app.err] Too many users!
> 17:44:00 Creating main window
> 17:44:00 A debug msg coming from {charts} module
> 17:44:00 Destroying main window
> 17:44:00 [app] [Thread 2188] However, this msg. will
> 17:44:00 [app.dbg] this will be written - this log just got enabled
> 17:44:00 [app.err] this will be written - all logs are enabled
> 17:44:00 [app.dbg] this will be written
> 17:44:00 a simple info
> Press any key to continue . . .
>
> And my out.txt file is in c:\winnt - somewhat to my surprise.
>
I would assume it's got something to do with the "Defaulting to Windows
directory." message :)

>
> I did quite a bit of fumbling to get the basic example working, starting
> right scratch as a complete novice.
>
> As ever, using macros, the error messages swiftly become inscrutable.
>
> Why would one want to create a file define.h just to hold one (or perhaps
> two) statements?

It was just an example ;)

>
> (I find the greyed out code MOST irritating. - I don't see why one should
> want to change the background at all - it just decreases legibility. A very
> slight background is ample and MUCH better IMO -
> .code { width: 100%; border: none; background-color: #f0f0f0; } or #f0f0fa ?

Yes, sorry for that -- fixed.
>
>
> A list of macros and their function would be helpful.

Noted, will do.

>
> I have, for example,
>
> #define BOOST_LOG_WIN32
> in init.cpp to activate

For VC this is not needed.

>
> #ifdef BOOST_LOG_WIN32
> manipulate_logs("DEBUG").add_appender(write_to_dbg_wnd );
> #endif
>
> and this works, writing to the console window.
>
> But the line
>
> manipulate_logs("app").add_appender(write_to_file("Test_log_out.txt") );
>
> doesn't seem to create the file I expect, anywhere.
>
> I would expect Test_log_out.txt to be in project \debug or \release?
>
> Or in c:\winnt???

I assume you have VC8.0, and I also assume that VC8.0 has (quite) a few
bugs in it. Normally, "Test_log_out.txt" should be created in the
project's Working directory, which by default should be the dir where
the .sln file is found.

>
> While I RTFM, perhaps you can advise on progress so far.

Lucky me I found out what RTFM means :)
(from which, I had only guessed the F right ;))

Your progress is fine. I would suggest using VC7.1 if you have it, it's
much more stable.
By the way, are you using some command-line only compiler?

Best,
John

-- 
John Torjo,    Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/surfaces.html - Sky's the limit!
-- http://www.torjo.com/cb/ - Click, Build, Run!

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk