Project

General

Profile

visual studio linking errors using the libharu libs

Added by Radu Marin about 11 years ago

Hello!

I want to create a PDF file from a HTML report, but i have linking issues, using VS2010. I'll explain the process i used to add WT to my project from the beginning.

I've downloaded the binary releases of wt-3.3.2 and installed them. I'm using Visual Studio 2010, so i created a new MFC project, dialog based with MFC static library and no UNICODE libraries.

Next, i've added (as in the installing notes):

In C/C -> General, Additional Include Directories: C:\Program Files\Wt 3.3.2 msvs2010 x86\include

In C/C -> WIN32 is defined

In Linker->General, Additional Library Directories: C:\Program Files\Wt 3.3.2 msvs2010 x86\lib

In Linker->Input added wtd.lib, wthttpd.lib for Debug and wt.lib, wthttp.lib for Release.

Next, i created a new C class, and tried to create a HPDF_Doc object:

@#include "hpdf.h"

void error_handler (HPDF_STATUS error_no, HPDF_STATUS detail_no, void *user_data)

{

printf ("ERROR: error_no=%04X, detail_no=%d\n",

(unsigned int) error_no, (int) detail_no);

throw std::exception (); /* throw exception on error */

}

void htmlToPdf()

{

HPDF_Doc pdf;

pdf = HPDF_New (error_handler, NULL);

}@

Trying to compile this simple code, i get

error LNK2019: unresolved external symbol _HPDF_New referenced in function "void __cdecl htmlToPdf(void)" (?htmlToPdfYAXXZ)

Did i miss something? Or is something wrong with what i've done so far?


Replies (4)

RE: visual studio linking errors using the libharu libs - Added by Wim Dumon about 11 years ago

Hi Radu,

The binary packages also include the libharu lib files, libhpdf.lib (for release builds) and libhpdfd.lib (for debug builds). You'll have to link to those libraries too.

BR,

Wim.

RE: visual studio linking errors using the libharu libs - Added by Radu Marin about 11 years ago

I've done that too, but i forgot to mention it. The link error is the same, in both cases.

RE: visual studio linking errors using the libharu libs - Added by Wim Dumon about 11 years ago

And if you add the definition HPDF_DLL to your project? (to make sure libharu functions are attributed with dllimport)

Br,

Wim.

RE: visual studio linking errors using the libharu libs - Added by Radu Marin about 11 years ago

Yes, adding the definition in Preprocesor did the trick. Thanks a lot!

    (1-4/4)