|
Boost Users : |
Subject: Re: [Boost-users] bjam does not find *.lib file
From: Ronny Herzog (herzog_at_[hidden])
Date: 2013-03-04 09:40:44
Thank you, Juergen,
there is a switch in the pugixml.hpp for the dll export. When I switch
this on, it does not complain about not-finding the *.lib. I am just
wondering, because the compilation worked some months ago.
Anyway, I get another strange error. It says
|error LNK2019: unresolved external symbol [...]|
The linker cannot resolve a function which is defined in the same file:
pugixml.cpp:
|//[...]
// Writer interface for node printing (see xml_node::print)
class PUGIXML_CLASS xml_writer
{
public:
virtual ~xml_writer() {}
// Write memory chunk into stream/file/whatever
virtual void write(const void* data, size_t size) =0;
};
// xml_writer implementation for FILE*
class PUGIXML_CLASS xml_writer_file:public xml_writer
{
public:
// Construct writer from a FILE* object; void* is used to avoid header dependencies on stdio
xml_writer_file(void* file);
virtual void write(const void* data, size_t size);
private:
void* file;
};
#ifndef PUGIXML_NO_STL
// xml_writer implementation for streams
class PUGIXML_CLASS xml_writer_stream:public xml_writer
{
public:
// Construct writer from an output stream object
xml_writer_stream(std::basic_ostream<char,std::char_traits<char> >& stream);
xml_writer_stream(std::basic_ostream<wchar_t,std::char_traits<wchar_t> >& stream);
virtual void write(const void* data, size_t size);
private:
std::basic_ostream<char,std::char_traits<char> >* narrow_stream;
std::basic_ostream<wchar_t,std::char_traits<wchar_t> >* wide_stream;
};
#endif
//[...]|
and pugixml.hpp:
|//[...]
namespace pugi
{
PUGI__FN xml_writer_file::xml_writer_file(void* file_): file(file_)
{
}
PUGI__FNvoid xml_writer_file::write(const void* data, size_t size)
{
size_t result = fwrite(data,1, size,static_cast<FILE*>(file));
(void)!result;// unfortunately we can't do proper error handling here
}
#ifndef PUGIXML_NO_STL
PUGI__FN xml_writer_stream::xml_writer_stream(std::basic_ostream<char,std::char_traits<char> >& stream): narrow_stream(&stream), wide_stream(0)
{
}
PUGI__FN xml_writer_stream::xml_writer_stream(std::basic_ostream<wchar_t,std::char_traits<wchar_t> >& stream): narrow_stream(0), wide_stream(&stream)
{
}
PUGI__FNvoid xml_writer_stream::write(const void* data, size_t size)
{
if (narrow_stream)
{
assert(!wide_stream);
narrow_stream->write(reinterpret_cast<const char*>(data),static_cast<std::streamsize>(size));
}
else
{
assert(wide_stream);
assert(size %sizeof(wchar_t) ==0);
wide_stream->write(reinterpret_cast<const wchar_t*>(data),static_cast<std::streamsize>(size /sizeof(wchar_t)));
}
}
#endif
//[...]|
Thanks for the help!
Ronny
Am 3/4/2013 2:40 PM, schrieb Jürgen Hunold:
> Hi Ronny,
>
> On Monday, 4. March 2013 14:28:58 Ronny Herzog wrote:
>> Dear all,
>>
>> I have troubles to compile because bjam does not find a *.lib file which I
>> would expect to be there. I am on Windows 7 with Boost 1.50.0 and visual
>> studio 10.
>>
>> It complains:
>>
>> LINK : fatal error LNK1181: cannot open input file
>> '..\boost-build\additional\msvc-10.0\release\address-model-64\threading-mult
>> i\pugixml.lib' Which is true, the compiler does not build a pugixml.lib. I
>> don't understand why it is not build, since I am building a *.dll. I would
>> appriciate any help, because I have no clue where I should look for the
>> problem.
> That is most probably the classical bug that the msvc link.exe does not
> generate a .lib export library when no visible symbols are available. Do you
> export your symbols from "pugixml.cpp" via "dllexport/import"? Your Jamfile for
> "pugixml" seems to contain no controlling define for that.
>
> Yours,
>
> Jürgen
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net