How to solve error "o rule to make target"? - c++

This Error pops up while I try to Compile the Project Map of Cartotype, I followed The Instruction on The Cartotype Documentation, but at this point I couldn't do any progress, help please !
:-1: error: No rule to make target 'G:/QT/Projects/cartotype-eval/CartoType-Public/src/apps/Maps/../../../../cartotype_windows_sdk_evaluation_5.10.7/CartoType/bin/15.0/x64/DebugDLL/libcartotyped.a', needed by 'debug/CartoTypeMaps.exe'. Stop.
My colleage tested same project on QT Linux - Ubuntu, and it worked smoothly !

I presume that you're using MinGW since the buildtool is looking for foo.a. You need to simply look at that error and understand what it means: a library it needs is missing. Until you provide that library, it won't build. That's the simple part. The hard part is that according to the SDK overview, CartoType comes with .lib libraries only, not .a libraries. But modern MinGW supports .lib files, so you only need to convince it to look for the .lib file, not .a file. Most likely, your build scripts have the reference to .a, or no full filename whatsoever.
If you're using QMAKE, you likely have something like:
LIBS += -LX:/cartotype_windows_sdk_evaluation_5.10.7/CartoType/bin/15.0/x64/DebugDLL cartotyped
Instead, you'd want:
LIBS += X:/cartotype_windows_sdk_evaluation_5.10.7/CartoType/bin/15.0/x64/DebugDLL/cartotyped.lib

Related

Codeblocks required files

I'm learning to use the Codeblocks editor and I would like to setup a SDL2 project. My question is about the necessary files in the SDL2 package.
In the bin directory there is:
sdl-config
In the lib directory there is:
directories -
cmake and pkgconfig
In the share directory there is:
aclocal
I deleted these files, but my experience with SDL2 and C++ is almost at a beginner level. My understanding is, that these support files are for various command line tools used for compilation. For example I know what pkg-config is and I searched somewhat for the other file types. Is it ok to delete these files since I am using Codeblocks, or will Codeblocks possibly require any of these in some unexpected way at a later time? that I might not have considered. As far as I know, Codeblocks makes full use of it's wizards and it's project handling is separate from these other tools. I basically like to set everything up as an Empty Project. I have no compilation issues or errors, but I wanted the opinion of someone more experienced on this.

Why can't I link this library using the GNU GCC Compiler on Windows (but on Linux I can)

I've been trying to link this CryptoPP library for some time now; no luck. Due to most of the resources relating to linking the CryptoPP library being on the Linux platform I temporarily installed Ubuntu on a VM and got CryptoPP working quite smoothly, however, as previously mentioned, it doesn't work on Windows.
I am using the CodeBlocks IDE on Windows 8 using the MinGW compiler.
I already have the static CryptoPP .a file built.
My 2 attempts at linking the CrypoPP library have been:
A:
- Add the locations of the header files to the compiler and linker search directories (so it doesn't give me those "Head not found" errors)
Add the library to the Link Libraries section (I added "libcryptopp")
I know that the compiler can see the Linked Library because when I change the name to the libcryptopp.a file to something else (libcryptopp1.a) it says "-llibcryptopp not found"
In the end I get a whole bunch of Undefined API error messages :(
B: I then tried to add the header and library files to my compiler directory in suspicion of my IDE's search directory somehow failing me, this was not the case; I received the same Undefined API error messages.
I am tired of fighting this, if anyone could please leave some tips or point something out that I'm doing wrong I would be very grateful.

Linking SDL_ttf library in C++

I'm having a problem linking SDL_ttf library with C++ compiler. I have tried three different programs and i couldn't solve the problem in any of them. I've tried Dev C++, Eclipse and CodeBlocks. In all of them it appeared a different error, but all related to not finding -lSDL_ttf or not recognizing the functions of that library.
I'm following this tutorial http://lazyfoo.net/SDL_tutorials/ and have done everything i have found on the internet. I copy the .h file inside /include/SDL/ directory, the .dll files inside the project directory, and the files within /lib directory into the /lib directory that i am using. I think the error might be here, as SDL_image for example, have ".lib" files, and in ttf there is no such file. They are all ".a" or ".la". I'm new to C++ so i don't know if i am doing something wrong.
Thank anyone for his help.
The error in code blocks is the following:
ld.exe cannot find -lSDL_ttf
Make sure you downloaded the correct version of the library. If you have ".a" files, you probably downloaded the mingw version. And for that you have to use a mingw compiler. If you are using something like Visual Studio, you need the version with -VC.zip at the end.
Hope it was useful.
Good coding ;-)

C++ Qt: Static builds and external dylibs

I've been doing some funny stuff in personal projects with Qt. I'm not an expert in this so if it's a dumb question (guess not I couldn't find anything useful) feel free to kill me.
Anyway, I'm in OSX and usually I compile the final versions against a static version of Qt using a shell script with this commands:
cd "project folder...";
PATH=/Users/TCB13/(...)/qt-source/bin:$PATH; --> Path to my static QT.
export PATH;
qmake -config release;
make;
make clean;
So far if I move the compiled binary to another computer without Qt installed everything works just fine! ;)
Yesterday I start to play around with a dynamic library provided by a company and I've included the dylib in my .pro file like this: (I've a copy of the dylib in the project folder)
#macx: LIBS += -L$$PWD/ -lwpsapi
#INCLUDEPATH += $$PWD/
#DEPENDPATH += $$PWD/
And when I compile it "statically" (using the commands above) and run it on the other computer I get:
dyld: Library not loaded: #executable_path/libwpsapi.dylib
Referenced from: /Users/TCB13/Desktop/dude111
Reason: image not found
Trace/BPT trap: 5
I noticed that the size of my compiled binary is the same with or without including the dylib so, I googled how to include and external lib and some people are saying that I need to add "CONFIG += static" to my .pro file. I did it and the size of the file increased but I still got the same error.
Hope someone can help me.
The error message is pretty clear, you need to distribute libwpsapi.dylib with your application. If you want to avoid that, consult the documentation of this third-party library to make it use the statically linked code. Note that the fact that you are telling the linker to link a static library, does not mean that the code is referenced. I suspect that there is some kind of preprocessor #define in the code (or defaulted) to use the dynamically loaded library.

How to Link Imagemagick library to Qt(windows)

I have developed an application with mac and for one month now, Im trying to link Qt with ImageMagick on windows.
I just cant find the files and the version of Imagemagick library that need to be linked to Qt in order to make my application work on windows.
I have tried most of the libraries from here
Thats the only thing I added to the .pro file while I was developing on a mac
INCLUDEPATH += . /opt/local/include/ImageMagick
LIBS += -L/opt/local/lib -lMagick++
When I add this to my .pro
INCLUDEPATH += C:/im6/include/ImageMagick
LIBS += C:/im6/lib/libMagickWand.a
LIBS += C:/im6/lib/libMagick++.a
LIBS += C:/im6/lib/libMagickCore.a
C:/im6/lib/libMagick++.a
I get 10.000 + simmilar errors to that:
(Image.o):C:\msys\1.0\home\cristy\ImageMagick-6.6.6-0/Magick++/lib/Image.cpp:4157: undefined reference to `__gxx_personality_sj0'
C:/im6/lib/libMagick++.a(Image.o):C:\msys\1.0\home\cristy\ImageMagick-6.6.6-0/Magick++/lib/Image.cpp:4157: undefined reference to `_Unwind_SjLj_Register'
C:/im6/lib/libMagick++.a(Image.o):C:\msys\1.0\home\cristy\ImageMagick-6.6.6-0/Magick++/lib/Image.cpp:4178: undefined reference to `_Unwind_SjLj_Unregister'
For more errors check this
Has anyone tried to build and deploy an ImageMagick application using qt on windows ?
Which files do I need to link while building and which files while deploying ?
The error message tells me that you
use mingw (with qtcreator). Your
library might not work with this
compiler. You need a mingw version
of the library, probably named
libmagick.a.
LIBS += -L$$quote(c:/Program Files/ImageMagick-6.6.5-Q16/lib) -lmagick
(see the documentation about qmake Project Files
I have found that the minGW tool set is very much treated as a "stepchild" in the Windows world. I know it doesn't help your particular situation, but we had numerous problems with third-party libs while trying to use Qt with minGW. There were always extra steps, or non-existent build instructions that we had to figure out or tweak.
Once we switched to the MSVC version, all of those problems went away. Note that this doesn't mean you have to use Visual Studio (you can still use Qt creator), it just means that the Visual Studio compiler is being used. You can get the compiler for free using the Platform SDK. If this is an option, you might save yourself a lot of pain by switching now. It's unfortunate, but that is just the current status quo, at least as we discovered.
Please go get ImageMagick source package.
I can’t give direct instructions how to work with MinGW of Qt Creator, but basically following. I prefer to use qtvars.bat that comes with binary distributions of Qt to set environment.
Open Windows cmd
Set PATH to have /path/to/mingw/bin and /path/to/qt/bin before other paths
Go to directory where you have extracted ImageMagick source
read README, INSTALL and such to compile the ImageMagick (most likely just ./configure ; mingw32-make, but never be sure)
Edit your .pro file with something like LIBS += -L$$quote(/path/to/imagemagick/lib/dir) -lmagick . The lib may be in bin dir or in lib dir. See hmuelner’s answer for more information.
At this point, the configuration should be ready. Compilation at Qt Creator should work, but you can as well use this cmd windows to compile your program: go to program directory, run “qmake” and “mingw32-make”.
You cannot link against a ImageMagick++ library built with MSVC, as mingw and MSVC DLLs are incompatible for C++ libraries. You can't link a MSVC-built C++ library into a mingw project, nor vice versa. C-only libraries work fine. Also, according to this fortum thread, using builds against old mingw-versions with current mingw versions doesn't work as the exception handling changed (as you get more errors than that, I wouldn't expect that to be the only problem though). If there is no binary package for your mingw version (and I don't see any on the imagemagick website), your only option is to use a source package, as Smar suggests.
Another option of course is to install Visual Studio, download Qt for MSVC and build your project with MSVC.