Poppler library for QT4 on windows - c++

I am making a program in which I will include datasheets of PIC processors. I now want to display these inside the QT program itself as a widget. I wanted to use poppler for this, but I am having a very hard time trying to get hold of these binaries! I can't seem to Cmake the poppler for QT4. Could anyone help me on how to make these libraries on Windows 7.
(I have never compiled/build anything yet on Windows, only Unix, I downloaded the CMAKE program, and tried to use this to generate it with the CMakeLists.txt file, but no luck so far.)
The best solution (because this way I could learn it myself, and never have this problem again) is a 'tutorial' on how to do it myself.
If not then giving me the libraries itself would be very much appreciated!

I'd wanted to point you to SumatraPDF, but it looks like they're not using poppler any more. You could have a look at the mupdf subdirectory though, it has MSVC makefiles for several libraries required for poppler. You might have some luck adapting them for building libpoppler itself.
You could also use Cygwin or MingW to get/build poppler.

You might have to take a look at this: Poppler: Displaying PDF Files with Qt

You can use the KDEWin installer to automatically get all the appropriate binaries for your machine. This is very useful and is the strategy used in many projects (including my CarMusTy, Carnatic Music Typesetting application).
Check out: http://www.winkde.org/pub/kde/ports/win32/installer/
It automatically downloads all the required dependencies when you ask it download the required binaries. And you can get the dlls suited for your particular compiler. (MSVC, MingW supported)
Also you can get the source code for poppler. KDEWin supports versions, so you can get the latest version binaries or any previous version you like.
Check out http://windows.kde.org/ for more details.
All the best
Gopalakrishna Palem
Creator of CFugue and CarMusTy
http://gpalem.web.officelive.com/

Related

How build harfbuzz without dependencies

I want build latest harfbuzz-ng library on Windows 7. But in build system by default I must go through long quest to gain: ragel, pkg-config, gtkdocize and other stuff. Even in the end if I get all what need for build system I get errors (sorry cannot say which concrete errors), last time I tried to build this library 2 month ago). Maybe on Linux system it is easy to get and build all this stuff but on Windows always something doesn't want to be compiled. Or the problem is that I don't find instructions which guide me on Windows, only Linux.
What I want to get is simple instructions how build only harfbuzz-ng with freetype dependency (and maybe add ICU) by MinGW compiler on Windows.
Thanks you very much.
For anyone reading this, have a look at harfbuzz.cc in the project which makes you able to use harfbuzz without any build system, just include it in one of your sources, no build system is required, define HB_NO_MT or even HB_TINY (which brings a minimal harfbuzz) if you don't use harfbuzz in multithread mode.
I don't know i this is the answer you are looking for. I am trying to work with Harfbuzz as well and did this through several attempts which did not work out for various reasons.
One (old) example you could use as a starter is: HarfBuzz static lib. The .lib-file generated works with UCDN and just needs this file plus a source for the Freetype-functions to provide the necessary FT_Face-parameter (i did this by compiling another .lib via the freetype-sourcecode (freetype.org/download.html).
But I am unsure if this will work out for the MinGW-compiler (you don't use VC++ as IDE do you??).
You may find of interest the MSYS2 build system. It is essentially a linux-style packaging system built on top of Windows(TM). You can download and install binary packages with simple commands (including automatic dependency solving). If you want to download a source package you can do that as well. http://msys2.github.io

Setting up OpenGL library on windows

I'm totally new to OpenGL, so I'm trying to compile my application at home. At my university I have everything settle by my professor in the lab and there I use Linux. At home I'm using windows 8 with visual studio 2013.
I'm trying to build a sphere in my app which contain the includes below:
#include <GL/glut.h>
#include <math.h>
#include <iostream>
So, since it contains Glut.h I went to http://www.opengl.org/resources/libraries/glut/glut_downloads.php#2 to download the library and make it rock, but I had some problems.
I thought the windows version would come compiled and it didn't. The dlls are not inside the package as I expected to link them in my project properties so I tryed to use CMake to compile the glut but it didn't work. CMake returns to me the following log:
CMake Error: Cannot open file for write: C:/Program Files/Glut 3.7 Build/CMakeCache.txt.tmp
CMake Error: The source directory "C:/Program Files/Glut 3.7/glut-3.7" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
CMake Error: : System Error: No such file or directory
CMake Error: Unable to open cache file for save. C:/Program Files/Glut 3.7 Build/CMakeCache.txt
CMake Error: : System Error: No such file or directory
It says that the folder doesn't contain the CMake file.
My download link to glut (supposed to be windows, not sure cos of the error) is this http://www.opengl.org/resources/libraries/glut/glut37.zip
Normally I programm java, which I dont have so many headaches to setup the IDE..so take it easy please and now I ask:
What am I missing to make my OpenGL code run?
Your teacher should help you at the first place.
I would like to inform you that GLUT library was abandoned since 1998. Last version is [3.7].But you are lucky!
"freeglut" is alternative to the OpenGL Utility Toolkit (GLUT) library.
Everything you need is here, I recommend reading it all.
And to help you out, here you can find Windows binaries, look for link called: "Download freeglut 2.8.1-1 for MSVC".
After download, you must link the library folder, include folder and copy freeglut.dll to you project folder (inside Debug or Release folder). You can find dll files inside a bin folder.
And after that, you can call #include "GL/glut.h" with no problems.
Good luck!
It doesn't compile with CMake. Open a Visual Studio command prompt and type nmake in the top level directory of the glut source code.
At my university I have everything settle by my professor in the lab and there I use Linux. At home I'm using windows 8 with visual studio 2013.
Then the very first thing you absolutely must do is heading to your GPU maker's website, download the newest drivers from there and install them. That is, because the drivers installed by default with Windows 8 lack proper OpenGL functionality.
So, since it contains Glut.h
You mean glut.h – file names are case sensitive on most operating systems (Windows not among them). So for portability reasons you should care to write them with the proper spelling.
I went to http://www.opengl.org/resources/libraries/glut/glut_downloads.php#2 to download the library
The old GLUT library isn't maintained for over a decade. Use an alternative implementation like FreeGLUT and use that.
so I tryed to use CMake to compile the glut but it didn't work.
Okay, here you got no technical problem, but a lack of understanding. Essentially your brain got what I call "IDE rot": All those sugar coating and clicky-pointy action of IDEs obscure what actually is going on when a program is built. You'll have to bit the bullet there and understand how the interaction between the build control generators the build system the compiler and the linker works.
CMake is a build control generator: In CMake you describe the build dependencies of your program sources. From that CMake generates the actual build information for the build system used (GNU make and GCC on Linux; NMake and MSVC++ compiler on Windows for example).
Of course for CMake to work there must be an appropriate CMake configuration present. And in the case of GLUT that's definitely not there (the last official release of GLUT predates the first release of CMake.
Now you should really wonder: Why did you call "cmake" in the first place? I bet, because you always did it so far, or you read it somewhere, without even trying to understand what's going on.
What you did was folloing a Cargo Cult – it somehow resembles the actual process, it looks like it from the outside, but it doesn't yield results. Feynman's speech later coined the term Cargo Cult Programming; interesting enough I was using that term (consistently with its definition, just due to being familiar with Feynman's speech) without knowing that other people already had coined it in exactly the same way. Such a often it happens, that people will come up independently with the same term for it.
Normally I programm Java, which I don't have so many headaches to setup the IDE
Well, that's your problem right there. You only know how to click around in an IDE. Even when programming Java, with an IDE, you should get intimately familiar with the actual build process: Java compiler, JAR file creating, and so on.
What am I missing to make my OpenGL code run?
I bet not very much. It's a lack of understanding how the build process for software works and is controlled. You'll have to bite the bullet and learn that first. And for that I suggest you install Linux or FreeBSD, or at least Cygwin on your computer.
Windows is not a very good system to learn those things, because its been built around clicky GUIs. That is not to say that Windows was a bad operating system. It's juat that you want to have something you can experiment with and quickly go through various iterations of build tool option switches. A GUI can't give you that.

How to convert a cmake project into a Visual Studio equivalent?

The situation is the following: I have the source code of one programm (lets call it programA) (written in C and C++), as well as the CMakeLists.txt and CTestConfig.cmake files. I already installed programA using CMake's graphical user interface and, as it is obvious, it worked. It created the .exe file (I'm working on Windows 7 OS).
The problem is that, right now, I've been asked to edit the program (and so, I must be able to edit the code and degugging it as changes are made). I also need to compile it but not in .exe anymore but in .dll so I can add it to a website we have.
I've read in forums that CMake can compile programA into a .dll if I need to, but as I would need to make some changes I consider that CMake debugging is not as useful and easy as using entirely VS. From the little I know from CMake language, the CMakeLists.txt is mainly used to check the OS of the user as well as adding some libraries in case they are not found.
I have to admit I have no idea in programming CMake directives, as I have been working with ASP.NET, C, C++ and C# mostly. Then, my idea is to try to work only in visual studio 2010 instead of using cmake as well, so once I have the program 'adapted' to VS and can be compiled just using VS, I'm ready to start my job. So the question I have is how can I perform the same task CMake did just using Visual Studio (Is there any way of implementing CMake directives in VS?), can VS compile by receiving as an argument something similar to that CMake.txt file (though it needs to be translated into another language)?
To skip the use of CMake I tried to copy the source code into a new project in VS. However as it does not use the CMake directives when compiling, it gives several errors, most of them related to the fact that some headers.h can't be found (cause they might be in a subfolder). And there are so many subfolders to add the paths to the predefined directories of search that it would take ages.
I'm sorry I can't be more precise in my explanation. I'm good at programming little projects on my own, but it's the first time I have to work on other's programm. Please don't hesitate to ask if anything was not properly understood
I would appreciate a lot any suggestion / advice /guidance you can give.
To make a dll, use add_library command and the SHARED keyword
add_library(mylib SHARED ${files})
this is easy with CMake, don't go back in visual that will be harder at the end
The Good News
Fortunately, cmake can generate VS Projects automaticaly for you (this tutorial s specific for OpenTissue, but Steps 1 to 3 should be the same for you).
The [not so] Bad News
Depending on the complexity of the project, VS Projects automaticaly generated by cmake can get pretty nasty, to the point of illegibility. It will, for example, hard link any library dependencies using the specific paths of your machine, so the project will most certainly not be portable across setups. In any case, that's the intended bahavior, because the primary idea of supporting this generator is simply making it work, thus allowing users to easily compile projects using MSVC, so there's not much you can do here. Nonetheless, it should work in your machine and will certainly be a great starting point for you, just create a project yourself from scratch copying the relevant parts out of the automatic generated version.

How do I zip a directory of files using C++?

I'm working on a project using C++, Boost, and Qt. I understand how to compress single files and bytestreams using, for example, the qCompress() function in Qt.
How do I zip a directory of multiple files, including subdirectories? I am looking for a cross-platform (Mac, Win, Linux) solution; I'd prefer not to fire off a bunch of new processes.
Is there a standard way to combine bytestreams from multiple files into a zipped archive, or maybe there is a convenience function or method that would be available in the Boost iostream library?
Many thanks for the assistance.
Update: The QuaZip library looks really great. There is an example in the download package (in the "tests" dir) that shows very clearly how to zip up a directory of files.
Update 2: After completing this task on my Linux build environment, I discovered that QuaZip doesn't work at all with the Visual Studio compiler. It may be possible to tackle all those compiler errors, but a word of caution to anyone looking down this path.
I have found the following two libraries:
ZipIOS++. Seems to be "pure" C++. They don't list Windows explicitly as a supported platform. So i think you should try your luck yourself.
QuaZIP. Based on Qt4. Actually looks nice. They list Windows explicitly (Using mingw). Apparently, it is a C++ wrapper for [this] library.
Ah, and of course, i have ripped those sites from this Qt Mailinglist question about Zipping/Unzipping of directories :)
Just for the record...
Today, I needed to do something very similar in Visual C++. (Though wanted to maintain the possibility to compile the project on other platforms; however preferred not to adopt Qt just for this purpose.)
Ended up using the Minizip library. It is written in plain C, but devising a simple C++ wrapper around it was a breeze, and the end result works great, at least for my purposes.
I have built a wrapper around minizip adding some features that I needed and making it nicer to use it. Is does use the latest c++11 and is developed using Visual Studio 2013, so it should work out-of-the-box for you.
There's a full description here: https://github.com/sebastiandev/zipper
you can zip entire folders, streams, vectors, etc. Also a nice feature is doing everything entirely in memory.
Poco::Zip is also a choice, it has clearly documentation and some code for demo.
Poco::Zip Document
system("zip myarchive.zip *");
I tried QuaZIP 0.4.3 on Windows with VisualStudio 2010 -- there are still issues but can be resolved easily.
To build with VS:
Use CMake to configure and generate VS solution for QuaZIP.
Open soltion with VS and build -- you'll first notice that it can't find 'zlib.h'.
Open preferences for quazip project and add path to Qt's copy of Zlib to C/C++->General->Additional Include Directories: $(QTDIR)/src/3rdparty/zlib.
Rebuild again and you'll get lots of warnings and one error C2491: dllimport static issue on QuaZipFile::staticMetaObject.
This is because QuaZipFile is declared like "class QUAZIP_EXPORT QuaZipFile" and QUAZIP_EXPORT needs to resolve to Q_DECL_EXPORT for dll and to Q_DECL_IMPORT for application, based on whether QUAZIP_BUILD is defined or not. When building QuaZIP QUAZIP_BUILD should be defined but isn't -- configuration process defines in error completely useless "quazip_EXPORTS" instead.
To fix, just remove "quazip_EXPORTS" from all build configurations and add QUAZIP_BUILD instead -- QuaZIP will now build fine.

cross compiling c++ to iphone arm

I've scanned over the (outdated) article that is the first hit on google about ARM cross-compiling. I've also seen the article about compiling OpenCV to the iPhone and the general cross compiling instructions there. My question is can I call the apparently already configured gcc/g++ in the iPhone developer package (which I already have installed) like in the latter article? A lot of the OpenCV stuff seems superfluous to my needs.
If I can, what would the calls look like? Should I create a Makefile to make things easier?
Also, I need -lncurses library. Can I call them like normal, or do I need to specify it's path because I'm not calling the default gcc/g++?
If you're using the official SDK, compiling C++ for the iPhone is as simple as including cpp files in your project and hitting "build". Of course you can still go in and tweak the compiler switches - well, most of them.
As for ncurses, I'm not sure why you'd want to use that - but the only limitation you should have is that you can't link against dynamic libraries - so you'd have to linked the object code in.
A script that you can use as a basis for crosscompiling your libraries for iOs development.
Unfortunately the [n]curses package is not going to do you any good for the iPhone.
[n]curses is designed to be used with a terminal window. This is just not available for the iPhone you will need to learn how to use Coco to develop a GUI interface.