64 Bit Libraries under VS2013

547 views
Skip to first unread message

Michael B

unread,
Mar 13, 2015, 5:03:12 AM3/13/15
to lib...@googlegroups.com
Hello there-

I have downloaded and compiled version 2.3 RC3 using the MSVC makefile and Visual Studio 2013.  

The reason that I was compiling a new version in the first place was because we are updating our program to be entirely 64 bit.  Anyhow, the old version (2.1) gave me linker errors when I compiled in x64, so I decided to compile the newest LibHaru version in hopes of gaining 64 bit compatibility.  After compiling the newest library file, I am still getting linker errors calling for unresolved external symbols.  I tried compiling it with x64 Native Tools Command Prompt as well as the regular developer command prompt and still the same linker errors when I import the library into my x64 project.  I double checked to be sure that the library was included in the additional libraries area as well as the input area.

One thing that was odd was that when I copied over the include files to my project, I was asked to find hpdf_config.h which was not inside the includes folder that I copied over.  The only place I could find a copy of that file was in the win32 folder of the LibHaru project.  I used that file, but should there be an x64 version of it?  Do I need to run a different nmake command to get an x64 library file?  Have I totally missed something?

Any help would be greatly appreciated! Thanks!


Nil Goyette

unread,
Jun 23, 2015, 5:34:21 AM6/23/15
to lib...@googlegroups.com
I have the same problem. Have you found a solution?

libHaru 2.3 RC3 was working in x32 and x64 with Visual Studio 2010 and 2012. I'm testing our application with VS2013 and now I can't get it to work.
I'll update this page if I find anything.

Nil Goyette

unread,
Aug 5, 2015, 3:09:36 PM8/5/15
to libHaru
I finally tested more and there's ... no problem.
I took one of the simple text example in /demo/, created a simple cmakelist and it worked.

What I did different this time is to take the static libs of libpng and zlib instead of the "normal" libs. There are a lot of choices and I'm not actually aware of what they mean, so I picked the wrong ones last time. Don't take "libpng16.lib" or "libpng16d.lib", and "zlib.lib" or "zlibd.lib". My libs were zlibstatic.lib, libpng16_static.lib and libhpdf.lib.

Maybe it would work with the shared version of libhpdf.lib. I didn't test.

Sergiu Oprean

unread,
Nov 23, 2015, 7:45:54 AM11/23/15
to libHaru
Hi, I am new to this compile & linking process. I manage to compile&link without including libpng and zlib, but when I tried to used the resulting dll into my own project I get linking errors.
e.g.
Error    46    error LNK1120: 28 unresolved externals
Error    30    error LNK2001: unresolved external symbol _HPDF_GetFont   
Error    15    error LNK2001: unresolved external symbol _HPDF_Page_BeginText  
....
and more of these:
Error    39    error LNK2019: unresolved external symbol _HPDF_AddPage referenced in function "public: void __thiscall CSEFDocPdf::Export(class CSEFDocViewerDoc *)" (?Export@CSEFDocPdf@@QAEXPAVCSEFDocViewerDoc@@@Z) 

Can you help me please with a step by step tutorial in creating a libharu.dll using the latest libHaru 2.3 RC3 sources under Visual Studio (I am using VS2012) ?

thank you,

Nil Goyette

unread,
Nov 23, 2015, 10:40:44 AM11/23/15
to libHaru
I don't have VS2012, nor the time to write/test a step by step tutorial, but I can ensure you that it works.
As I said in my last message, I'm not at all an expert in those things, but when you have link errors, it means that your "includes" is ok, but your "libraries" aren't ok.
  1. Make sure you built everything with VS2012 (zlib, libpng and libharu)
  2. Make sure they exist where you think they exist.
  3. If they do, make sure VS knows where they are (either by cmake or by the project properties).
  4. If it still does't work, test with static and shared. In my case, I needed to use static because I use a big framework with special rules,but it was the first time in my life I had to check that.

Good luck.

von Bargen, Joergen

unread,
Nov 24, 2015, 4:59:39 AM11/24/15
to lib...@googlegroups.com

Please try in the libHaru dll project at “Project Properties/Linker/Input” to add libhpdf.def (should be locate at \libharu\win32\msvc)  as “Module definition file”.

Regards Jørgen

--
--
---
libHaru.org development mailing list
To unsubscribe, send email to libharu-u...@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "libHaru" group.
To unsubscribe from this group and stop receiving emails from it, send an email to libharu+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.




Disclaimer :
The information contained in this e-mail is intended only for the individual
addressed. If you have received this e-mail by mistake, please notify us
immediately by return reply. Be sure to delete this message and all its
attachments from your system. Please note that any unauthorized review,
copying, disclosure or any other use of this information is strictly prohibited.
E-mail transmission cannot be guaranteed to be secure or error-free as
information could be intercepted, corrupted, lost, destroyed,received late
or incomplete, or could contain viruses. The sender therefore does not accept
any liability for any error or omission in the content of this message, either
of which are caused as a result of e-mail transmission.
If verification is required, please request a hard-copy version.
Thank you .

Sergiu Oprean

unread,
Nov 24, 2015, 7:29:11 AM11/24/15
to libHaru, Joergen....@sartorius-intec.com
I keep getting the same errors I mentioned earlier on the project I am trying to use the libharu.dll. For sure I am missing something...

This is what I did so far:
I compiled the libpng like in this video: https://www.youtube.com/watch?v=7XxVebzK3ac
I used the necessary *.lib files from release and *.h files required by libharu to compile (using both nmake -f scripts/Makefile.msvc_dll)
This is the only warning I get:
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
I also compiled via Visual Studio project I created and added '/NODEFAULTLIB:LIBCMT ' in the Project Properties/Linker/Command Line and I have a compilation with no errors, nor warnings.

When added libhpdf.def to “Project Properties/Linker/Input”, I get the following errors:
LNK1120: 1 unresolved externals
LNK2001: unresolved external symbol HPDF_3DAnnot_Set3DView

any other ideas to look for?

thank you,
Sergiu

von Bargen, Joergen

unread,
Nov 24, 2015, 8:18:42 AM11/24/15
to Sergiu Oprean, libHaru

Please comment HPDF_3DAnnot_Set3DView in libhpdf.def using ‘;;’. Don’t know who added this to the def file, but my libHaru links fine while HPDF_3DAnnot_Set3DView is commented out.

Regards

von Bargen, Joergen

unread,
Nov 24, 2015, 8:25:13 AM11/24/15
to libHaru, Sergiu Oprean

Next step: „References“. In the project, where you get the linking error (probably your main program, or another DLL which references functions from libHaru) do

·         Right-mouse-click on the project, Properties

·         On the left expand “Common Properties” and enter the Tab “References”

·         Make sure, libHaru in mentioned in the “References:” list. If not, click on “Add New Reference…” and in the “Add Reference” Dialog check libHaru and click ok.

·         Rebuild the solution.

Result?

 

Regards

 

 

From: Sergiu Oprean [mailto:opr...@gmail.com]
Sent: Tuesday, November 24, 2015 2:19 PM
To: von Bargen, Joergen
Subject: Re: [libharu] Re: 64 Bit Libraries under VS2013

 

Thank you, indeed, commented that line solved the 'unresolved external symbol HPDF_3DAnnot_Set3DView ' and now I am back with the old errors,
LNK1120: 28 unresolved externals
LNK2001: unresolved external symbol _HPDF_GetFont
...
LNK2019: unresolved external symbol _HPDF_AddPage referenced in function "public: void __thiscall ...

no idea ...

 

 

On Tue, Nov 24, 2015 at 3:07 PM, von Bargen, Joergen <Joergen....@sartorius-intec.com> wrote:

Please comment HPDF_3DAnnot_Set3DView in libhpdf.def using ‘;;’. Don’t know who added this to the def file, but my libHaru links fine while HPDF_3DAnnot_Set3DView is commented out.

Regards

 

From: Sergiu Oprean [mailto:opr...@gmail.com]

Sent: Tuesday, November 24, 2015 1:29 PM
To: libHaru
Cc: von Bargen, Joergen




--

Orice faci, fii creativ, continuă să explorezi necunoscutul. Fii inovator, inventează, descoperă, creează ceva pentru că Dumnezeu este Creatorul şi de fiecare dată când tu eşti creativ, te apropii de El. De fiecare dată când eşti creativ, Dumnezeu creează prin tine ...

Sergiu Oprean

unread,
Nov 24, 2015, 8:36:27 AM11/24/15
to libHaru, opr...@gmail.com, Joergen....@sartorius-intec.com
I think you assume that I have the libHaru project as part of the solution, which is not the case. Eventually I can try this too, on the other hand, I have an old libharu.dll & libharu.lib from 2008 with which is linking just fine. I just need a newer version as there are some new function for TTF I really need them. I will try to bundle the libHaru project into my main project. I'll let you know, thank you!

von Bargen, Joergen

unread,
Nov 24, 2015, 8:43:01 AM11/24/15
to Sergiu Oprean, libHaru

> I think you assume that I have the libHaru project as part of the solution,

 

Yes, this was my assumption. I use "2.4.0dev" and have added it to my solutions as additional win32 dll project. (together with zlib-1.2.8 as another dll project, but without png, I don’t need it for now). There are some issues with libHaru ¹), but there seems to be no real maintainer, there is no reaction on github :-/

 

Regards

 

 

¹) See https://github.com/libharu/libharu/issues/111 and also https://groups.google.com/forum/#!topic/libharu/uQi2FqN98ng

 

Sergiu Oprean

unread,
Nov 24, 2015, 9:09:47 AM11/24/15
to libHaru, opr...@gmail.com, Joergen....@sartorius-intec.com
I added as an additional win32 dll project, added as a refference for the main project and ... the errors are still there. That issue with buffer overflow didn't happen to me yet, but thanks for the tip.

Sergiu Oprean

unread,
Nov 26, 2015, 3:39:11 AM11/26/15
to libHaru, opr...@gmail.com, Joergen....@sartorius-intec.com
Configuration\C/C++\Preprocessor\Preprocessor Definitions need this: HPDF_DLL. (I use libharu as shared dll).
http://libharu.sourceforge.net/compile_your_program.html
Wished this would be writen somewhere in new wiki, although you can deduce this from the demo code:
......
#ifdef HPDF_DLL
void  __stdcall
......
and hpdf.h
......
#ifdef HPDF_DLL_MAKE
#    define HPDF_EXPORT(A)  __declspec(dllexport) A  __stdcall
#else
#    ifdef HPDF_DLL_MAKE_CDECL
#        define HPDF_EXPORT(A)  __declspec(dllexport) A
#    else
#        ifdef HPDF_SHARED_MAKE
#            define HPDF_EXPORT(A)  extern A
#        endif /* HPDF_SHARED_MAKE */
#    endif /* HPDF_DLL_MAKE_CDECL */
#endif /* HPDF_DLL_MAKE */

#ifdef HPDF_DLL
#    define HPDF_SHARED
#    define HPDF_EXPORT(A)  __declspec(dllimport) A  __stdcall
#else
#    ifdef HPDF_DLL_CDECL
#        define HPDF_SHARED
#        define HPDF_EXPORT(A)  __declspec(dllimport) A
#    endif /* HPDF_DLL_CDECL */
#endif /* HPDF_DLL */

hope this will help someone ...
Reply all
Reply to author
Forward
0 new messages