How exactly compile sqllite app in Code Blocs on Windows in c++ - c++

(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

Related

Building C++ API of Third Party Library in Visual Studio C++ Project

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!

Linking libjpeg to an xCode project for iOS dev

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

Building proto3 library in windows for C++

I've successfully generated .cc and .h files from a proto2 protobuf. I've also followed the directions at https://github.com/google/protobuf/tree/v2.6.1/vsprojects to create the lib to link against. I created a couple projects in visual studio and was able to create two executables for the addressbook example. Everything works as advertised.
I'm now looking at proto3, as it's likely I'll need support for objective-c. It's trivial to download the precompiled binaries to generate .cc and .h files, but I cannot figure out how to duplicate the above steps in windows to create a lib for me to link against. Has anyone else been able to do so? Thanks.

Using sqlite under windows

I'm developing an app with Qt and sqlite. I had no problems while I was working under Linux, but now I have to switch to Windows for a while, and i'm stuck with a simple question.
I've downloaded the sqlite source, and compiled it with Qt as a static library. As an output, I've got three files: libsqlite.a, shell.o and sqlite3.o. I strongly believe that the libsqlite.a is my static library.
Now, I want to use it in my project. In the project directory, I've created a folder called sqlite, and put the files inside of it.
After that, I'm trying to add the library to my project. In the .pro file, I add this:
LIBS += -L"/sqlite" -l"libsqlite"
However, I keep getting an error saying:
cannot find -llibsqlite
What am I doing wrong?
"lib" prefix must be omitted.
Use the
-lsqlite
linker directive.
P.S. Another viable option is including the SQLite's sources directly to your project. There's a SQLite "amalgamation" package (only sqlite3.c and sqlite3.h files).

Making a GCC based Project Build and Run under Visual Studio 2010

I have been trying to port my C++ based mass data transport protocol project into visual studio 2010 with no success :(
The code I have been working on is fully compatible with Win based systems..well this is what my mentor also says :) But I have not been able to make the project build and run using my existing *.h & *.cpp files under VS 2010.
The Project basically is a API under which i have 4 separate applications. The hierarchy would be:
SRC FOLDER- all the *.h and respective *.cpp files
APP FOLDER- 4 applications (the API / library and some *.h files to be available before linking such as the final dll file under SRC folder & the main header file under APP folder)
I do also have a makefile as when the project was developed on Linux platform but I have no idea how to implement the same on Visual Studio 2010
FYI: VS 2010 on compiling reports that there are missing header files such as <cstdlib>, <unistd> but my best bet is this is not the real prob. but the prob. lies in the way I make the project build itself. I don't know should I go with making a dynamic dll project for the main library and then make the 4 empty c++ projects inside that for the 4 respective applications..?
Cheers,
echo9
I would recommend that you parse the data that you need from the working .mak file that you used previously. Create an empty project & sln, then add the contents of the "src" by using "add->existing files" in the file menu.
At that point open up the project configuration settings and go through the C++ and linker settings one by one. At each step have a look at the linux .mak file and see that you are choosing equivalent options and path settings. In particular make sure that you add all of the necessary include paths to where your .h files are.
That's what I would do anyways... same process as porting forwards old MSVC4 .mak projects to a modern version.