Using Wt with Visual Studio 2013
Added by Barış Meriç over 8 years ago
Hi,
I'm trying to use Wt html->pdf feature with Visual Studio 2013 but i get linker errors.
I downladed pre-built binaries for VS2013, defined HPDF_DLL, set include/lib folders for project and compiled this snippet;
#include <hpdf.h>
#include <Wt/Render/WPdfRenderer>
namespace {
void __stdcall error_handler(HPDF_STATUS error_no, HPDF_STATUS detail_no,
void *user_data) {
fprintf(stderr, "libharu error: error_no=%04X, detail_no=%d\n",
(unsigned int)error_no, (int)detail_no);
}
}
using namespace Wt;
int main() {
HPDF_Doc pdf = HPDF_New(error_handler, 0);
HPDF_Page page = HPDF_AddPage(pdf);
HPDF_Page_SetSize(page, HPDF_PAGE_SIZE_A4, HPDF_PAGE_PORTRAIT);
Render::WPdfRenderer renderer(pdf, page);
renderer.setMargin(2.54);
renderer.setDpi(96);
renderer.render("<p style=\"background-color: #c11\">Hello, world !</p>");
HPDF_SaveToFile(pdf, "hello.pdf");
HPDF_Free(pdf);
}
But i get "LNK2019: unresolved external symbol "LNK2019: unresolved external symbol "_declspec(dllimport) public:thiscall Wt::Render::WPdfRenderer::WPdfRenderer(void *,void*)\" (imp??0WPdfRendererRender@Wt@
QAEPAX0
Z) referenced in function _main" error.
I'm linking these libs;
- libhpdfd.lib
- wtd.lib
- wtdbod.lib
- wthttpd.lib
- wtisapid.lib
- wttestd.lib
Is it a link order issue or am i missing something?
Replies (4)
RE: Using Wt with Visual Studio 2013 - Added by Wim Dumon over 8 years ago
Hey Baris,
This is likely a misbuild of the Wt binary. Can you file a bug report for this and assign it to me?
Thank you,
Wim.
RE: Using Wt with Visual Studio 2013 - Added by Neal Josephson about 8 years ago
Was there ever a resolution or workaround on this? I'm having this same behavior using the most recent stable build.
RE: Using Wt with Visual Studio 2013 - Added by Wim Dumon about 8 years ago
Hey Neal,
If you build the binaries yourself, you will not have this problem.
Wim.
RE: Using Wt with Visual Studio 2013 - Added by Claudio White almost 7 years ago
I have the wt binaries v3.3.6 and the same linker Problem (use with VS 2015), how can i solve this without generating own wt binaries?