Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: Linking problems with Visual Studio 8: msg#00035

apache.logging.log4cxx.user

Subject: Re: Linking problems with Visual Studio 8

Problem solved. Some of the log4cxx include files are auto generated.
On the Windows platform, I was using a set of include files I had
copied over from Linux. The log4cxx.h from Linux specified a UTF8
logchar, the proper one from Windows specifies a wchar logchar.

I was using the Windows include files to build the log4cxx shared
library, and the Linux include files to build my library. This meant
anything with a LogString had a type mismatch.

Thanks for listening.

charlie

On 12/19/06, Charles Tuckey <charles@xxxxxxxxx> wrote:
Hi,

I built the log4cxx library on WXP SP2 with no problems. But when I
try to link a very simple dll to it I get an unresolved symbol
problem. My problem is very similar to Sorin Popa (Nov 28 email). I
have some ideas on what the problem might be but I am not a very
strong C++ programmer and I have little experience on Windows as well
so I haven't been able to solve this. Details are below. Any help, or
gentle nudge in the right direction, would be greatly appreciated.

1) log4cxx build
- I'm using the HEAD from Nov. 13m 2006
- I built according to the instructions in INSTALL except:
- I added unxutils to my path so I could access the 'patch' command
- I ran setenv.cmd from Microsoft Platform SDK for Windows Server 2003 R2 dir
- my command line was 'ant build'
- I ended up with a debug lib

2) my library
- the source consists of two files: EngineAppender.h & EngineAppender.cpp
EngineAppender.h listing:
#include <log4cxx/appenderskeleton.h>
#include <log4cxx/spi/loggingevent.h>
#include <log4cxx/helpers/pool.h>

class EngineAppender : public log4cxx::AppenderSkeleton {
protected :
void append(const log4cxx::spi::LoggingEventPtr& event,
log4cxx::helpers::Pool& p);
public :
void close();
bool requiresLayout() const;
};

EngineAppender.cpp listing:
#include "EngineAppender.h"
#include "log4cxx/spi/loggingevent.h"

void EngineAppender::append(const log4cxx::spi::LoggingEventPtr& event,
log4cxx::helpers::Pool& p) {
event->getLoggerName();
}
void EngineAppender::close() { }
bool EngineAppender::requiresLayout() const {return 0;}

- before building I ran setenv.cmd to set up my environment
- then I ran
#include "EngineAppender.h"
#include "log4cxx/spi/loggingevent.h"

void EngineAppender::append(const log4cxx::spi::LoggingEventPtr&
event, log4cxx::helpers::Pool& p) {
event->getLoggerName();
}

void EngineAppender::close() { }

bool EngineAppender::requiresLayout() const {
return 0;
}

- I create the library with these two commands:
cl -DWIN32 -D_WIN32 -EHsc -Ilog4cxx/include -c EngineAppender.cpp
link -DLL EngineAppender.obj -out:test.dll log4cxxd.lib

It fails with the error:
EngineAppender.obj : error LNK2019: unresolved external symbol "public: class st
d::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >
const __thiscall log4cxx::spi::LoggingEvent::getLoggerName(void)const " (?getLog
gerName@LoggingEvent@spi@log4cxx@@QBE?BV?$basic_string@DU?$char_traits@D@std@@V?
$allocator@D@2@@std@@XZ) referenced in function "protected: virtual void __thisc
all EngineAppender::append(class log4cxx::helpers::ObjectPtrT<class log4cxx::spi
::LoggingEvent> const &,class log4cxx::helpers::Pool &)" (?append@EngineAppender
@@MAEXABV?$ObjectPtrT@VLoggingEvent@spi@log4cxx@@@helpers@log4cxx@@AAVPool@34@@Z
)

3) My troubleshooting
- In the log4cxx library the mangled name for getLoggerName is:
?getLoggerName@LoggingEvent@spi@log4cxx@@QBE?BV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@XZ

This differs from the name the linker is looking for in the
parameterized type to basic_string. The log4cxx library has _W (wchar)
and my linker is looking for a char type (D). (Sorin's linker was
looking for an unsigned short, G).

Even though I thought it would have no effect since I am using VC 8 I
tried compiling with the -Zc:wchar_t option. No change.

So, I'm stumped. How do I make my object file compile using
basic_string<wchar>? I cannot find anything on goolge (that I can
understand) that would help me solve this.

Thanks for your help,
charlie



--
Regards,
Charlie



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
hardware.arm.at...    cms.citadel.dev...    video.gstreamer...    java.facelets.u...    misc.basics.qna...    web.wiki.instik...    network.uip.use...    xdg.devel/2003-...    tex.bibtex.bibd...    finance.quotesp...    ietf.zeroconf/2...    redhat.blinux.g...    suse.db2/2003-0...    php.phpesp/2004...    uml.devel/2003-...    gnome.labyrinth...    qnx.openqnx.dev...    boot-loaders.gr...    db.dataperfect....    audio.audacity....    linux.uclinux.m...    editors.j.devel...    os.openbsd.tech...    kde.users.multi...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation