logo       

Linking problems with Visual Studio 8: msg#00034

Subject: Linking problems with Visual Studio 8
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



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

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | 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