Good evening,
I have been working on a C++ project from someone of my University which I had to improve for my Bachelor thesis. It basically uses the library libjpeg to do some computation resulting in a steganographic process in order to embed a message into a given image.
Now that the C++ code works smoothly, I'd like to create a little iOS app allowing the user to encrypt whatever message he'd like into an image of his choice. So I created an xCode project following this procedure: using c++ in an iOS app
I also found the following file: libjpeg for iOS which allowed me to compile libjpeg for iOS. Since I'm not so sure how to use the framework freshly created and couldn't find anything sufficiently convincing on the internet, I put all the files (.c and .h) of the libjpeg library into my "include" folder where I have my own .hpp.
xCode only throws me the following error:
xCode error
From what I could gather on several posts, I have to modify the build options of my xCode project to link manually the library, so I tried the following:
Other linking flags
Library search path
This wasn't enough to do the trick and I'm still struggling with the same error xCode throws at me. Any help would be very appreciated on how to proceed!
Thanks a lot,
Theo.
Do not add the .c files to your project, add the libjpeg.a file produced by your build to your project. Add the .h files as you are already doing, or edit the project settings to include their containing folder in the search path.
HTH
Related
I have been successfully testing an image processing library (https://github.com/libvips/libvips) in a C++ project in VS2017. I am new to C/C++ and I have been following the documentation here which describes the C way of using the library. There are features I would like to try in the C++ API, but the C++ API needs to be built with the same compiler as my project. According to the author:
It's slightly awkward to set up under Windows. The problem is that C++
does not have a ABI, so you must use exactly the same C++ compiler for
your whole project. This means the libvips C++ win binary (built with
g++) won't work with MSVC C++.
You need to copy the libvips C++ API source code into your own project
and build it with your own code. It's just a few files and pretty
simple to incorporate:
https://github.com/libvips/libvips/tree/master/cplusplus
I have made several attempts to build the minimal set of files but I have not had any success.
My steps so far:
Create a C++ console app in VS2017, set to Debug and x64
Extract the 'vips-dev-8.10' folder from vips-dev-w64-all-8.10.6.zip to where the project file is (this contains all the built .dll files, .lib files, .h files etc.)
Extract 'cplusplus' folder from 'libvips-master.zip' to where the project file is (this has all the project source files including the cplusplus folder which is the part I have to build per the above explanation)
Add the following folders to Project > Properties > C/C++->General > Additional Include Directories
C:\Projects\ConsoleApplicationVIPS3\ConsoleApplicationVIPS3\cplusplus\include\vips
C:\Projects\ConsoleApplicationVIPS3\ConsoleApplicationVIPS3\vips-dev-8.10\include
C:\Projects\ConsoleApplicationVIPS\ConsoleApplicationVIPS\vips-dev-8.10\lib\glib-2.0\include
C:\Projects\ConsoleApplicationVIPS\ConsoleApplicationVIPS\vips-dev-8.10\include\glib-2.0
Add the 5 .cpp files from the cplusplus folder into the project Source Files folder and Add them in the project tree.
Build the project.
As a result I get the following errors:
I haven't written any code yet. I thought I should just be able to point to the .h include files and compile the required C++ files. It's not clear to me what else I might need to add, but it definitely seems like I don't understand the correct procedure to build the project. I watched some videos on C++ compilation like this one but I cant see where I went wrong.
Any thoughts would be much appreciated.
EDITS 3-Jun-21
I have made some changes. I have instead extracted the exact version of the library according to the suggestion by #Frank, and I also discovered the usefulness of the compiler output window, thanks #Alan Birtles.
I am still getting errors, but I am not clear why. The first error is:
E0020 identifier "VImage" is undefined
Which is odd because I have added the folders to Project > Properties > C/C++->General > Additional Include Directories, and one of them is ..\cplusplus\include\vips which contains VImage8.h
And the Output window shows
Any further advice would be appreciated!
I have been programming a game in c++ using the sfml library. However, I would like to adjust some of the code of that library, and use that altered code in my project.
So instead of linking the dll I would like to add the source code and then play with that source code. (e.g. for speed optimization).
I know that doing something like that is generally speaking a bad idea. Howeover, I want to learn by playing around a bit and trying different things.
So how would I add the sfml source code to my c++ project in MS visual studio. Note that I am a total noob. I already tried adding the sfml folder that I downloaded from git in the project properties page called "Additional Include Directories", but i am getting errors, of the form "Cannot open include file: 'SFML/Graphics/GLCheck.hpp': No such file or directory" so I guess that i have not yet done enough.
If you want to modify the source code in the library, all you'd have to do is just navigate to where you have SFML installed and go into the code files with a text editor and edit them.
Then, you could link the library to your VS project the same way you would normally but that library is now modified by you.
Seeing as you have a search directory issue already in VS, you must fix that first. Fix that and then go and modify the library's .hpp, .h, .cpp, whatever files in-place.
To fix the search issue.... I don't use VS for graphics, I use CodeBlocks so I am not sure about their GUI to link libraries and change search directories... but, find out where you installed SFML. Check your /usr/include/, it's probably there. Specify that path in the search directories. Just go and find where that GLCheck.hpp file is located. For Example: Say it's full path is /usr/include/SFML/Graphics/GLCheck.hpp... then /usr/include/SFML/Graphics/ or just /usr/include/ (VS might handle it recursively) needs to be in the list of SEARCH DIRECTORIES.
(My first question)
I have no idea how i can compile and link my project in Code Blocs on Windows in c++ properly. I included and i set up it's localization in compiler options. I assume that i need to link any library. I read that it can by sqlite(3?).lib but in all downloadable files on sqlite project site is only .dll
huge thx for help
The suggested way of using the SQLite library is to embed it directly in your application, i.e., download the amalgamation source code, and just add the sqlite3.c and .h files to your project in the sample place where you have the other source files.
Also how build sqlite lib , how to use def files
I'm trying to use curl from within my windows c++ app but keep running into problems.
I'm using visual studio 2013 on a windows 8.1 machine.
Here's what I've done so far:
Cloned the repo from github
Built the libcurl project which produced three files: libcurl.dll, libcurl_imp.lib and libcurl_imp.exp
In my app project I added the curl include directory to the Additional Include Directories
Added the libcurl_imp.lib to the Additional Dependencies
Built my project
When I run my executable it says:
the program can't start because libcurl.dll is missing from your computer
I found a few things on it, but they solved it by adding the libcurl dll along with the exe, which isn't what I'm looking for as I want my executable to contain the libcurl so that it will work on machines without the need to have the dll.
Any ideas?
Thanks.
Edit
The 2nd step is done pretty much straight forward, I just right clicked on the project (libcurl) and chose buiild.
Due to the comments I've rebuilt it after changing the Configuration Type to Static library, so now it only produces one file: libcurl.dll which, as far as I know not a static library...
2nd edit
I wasted too much time on getting http functionality, and based on the info which I found thanks to a comment here (using libcurl without dll) I've decided to abandon this approach, and I found something which suits my needs perfectly and is simple to install/use: C++ REST SDK (codename "Casablanca")
Try to add libcurl.dll directory to PATH environment variable.
I am trying to embed the mono runtime in a C++ OS X console app (Will be used for scripting logic in a home-brew game engine, much like Unity3D). I am using XCode as the IDE and am failing spectacularly at linking the mono libraries. I come from the dark side (Windows) and am new to mac libraries and XCode.
I have successfully built mono and referenced the header folder but get a slew of APPLE-MOCH-O linkers errors no matter what .a I add to the project. I have also successfully built this sample project https://github.com/inkdev/Embedded-Mono-Sample for windows. The mono site on the topic http://www.mono-project.com/Embedding_Mono is confusing and of little use to me.
Help would be hugely appreciated.
EDIT:
If I remember correctly, I followed these commands http://www.mono-project.com/Compiling_Mono_on_OSX and got the source from here: https://github.com/mono/mono/tree/master/mono, and used make and make install. I added the /mono/include... folder to XCode's "Header Search Path" and that resolved all the unfound includes. Under /mono/lib/ I have tried several different *.dynlib files ( drag them into XCode ) but none have worked. libmono-2.0.1.dylib says "..file was built for unsupported file format..", and libmonoboehm-2.0.dylib simply says "...Undefined symbols for architecture x86_64..."
To anyone in the future who wants to compile and link the Mono runtime in XCode, here are the steps I followed.
Grab/Extract the latest *.tar.gz from: http://download.mono-project.com/sources/mono/
Follow these instructions: http://www.mono-project.com/Compiling_Mono_on_OSX
Open up /mono and drag /mono/lib/libmono-X.X.dylib into your XCode project ( Make sure it is adde to target ).
In XCode, select your project, select your target, select Build Settings.
Search for "Header Search Paths" and add: /mono/include/mono-X.X
Use this source code to test it out: https://github.com/inkdev/Embedded-Mono-Sample
You may need to copy /mono/etc/mono/X.X to /mono to fix a runtime error.
All your monos are belong to us now, enjoy.