I dont know how to connect SQLite with c++ on visual studio - c++

im begginer as a sql programmer. I want to make my first app with data base. SQLite seems to be the best for me but i have no idea how it works. I have done what is written here: https://www.tutorialspoint.com/sqlite/sqlite_installation.htm but dont know what next. i downloaded the first one from here where are 2 files .h and 2 files .c .I suppose that i have to use it somehow, because i need to include SQLite in visual studio but dont know how

Just include the sqlite files into your project (that is in solution explorer right click on the project node and select Add->Existing files and then select the files, they should be copied into the project directory), you can then #include the header file and use sqlite calls from your own source.

Related

Visual Studio community 2019 cannot add cpp files to project

file browser
Installation details
Main problem:
I have created a new, empty project and I want to populate it with
pre-existing .cpp files and a header file, but the file browser does
not allow the .cpp or .h extensions to show.
Possible cause 1:
I think it might be the installation details
Possible cause 2:
I have some legacy files from visual studio code
Context:
I migrated from using VS code to VS because code somehow wasn't able
to compile the 2 .cpp and 1 .h files my teacher gave me. I got tired
with messing about JSON files and compilers and such and threw in the
towel when my professor recommended the school's preferred IDE.
In Solution Explorer, right-click on your project and select Add → Existing Item... (You have probably clicked on the solution itself rather than on the project.)

Visual Studio 2019 is having several problems, including loading files

I have been working on a project for a while now (C++), in Visual Studio 2019, but I've suddenly run into several problems that send me in circles between them.
I loaded it one morning, and found that it couldn't load any of the files.
So thinking I must have accidentally moved files or something, I just copied my files again from my Github repository, but then it started having problems with every include file for the headers.
Manager.h is in a different folder in the project, which makes this more confusing to me because if the source files can't open a header file in the same solution, the headers should have problems opening a different header in a different part of the project.
I've tried deleting the project settings and reloading it, but VS won't reload them, and Github desktop is freaking out with any action with the project.
Cloning my repository again and loading that just sends me back to the first problem...
Anyone have any other ideas for what I can do?
Check to see if the files are in the folder present in the error message. If they are that can be a problem with the config files of the project/solution.
Possible solutions:
Since you have the project in the repository, a quick way to solve it would be to delete your local project and clone the repository project. (Or clone it to a different location)
You can try to repace the <Subscriber.h> by "Subscriber.h".
Create a new empty project and add all the project files through the Solution explorer:
right-click on the folder where you want to add the project (I recommend Source for the .cpp and Headers for the .h);
Select Add -> Existing item -> select the files.

Visual Studio 2019, no Intellisense with "Show all files"

I have started learning C++ with Visual Studio 2019 and noticed a strange behaviour. When you create an empty project you are represented with "Filter" files. Now if I active "Show All Files" I can create directories. I created the following structure:
/Core/
/Engine/
Main.cpp
Now if I create a "class" it is, by default, created next to Main.cpp. I would then move the Class.h and Class.cpp into /Core/.
Now if I start editing the newly created files I loose Intellisense. If I uncheck "Show All Files" I get it back. Does anyone else have the same problem?
Another question I wanted to ask was about filter files and project folder structure. Should I use the filter files to organize my project or an actual folder structure? I'm slightly confused because of the Intellisense problem, that's why I'm asking.
And if I should create a folder structure, how should I handle includes like this #include "..\..\... \FileUpInTree.h". In Javascript and Webpack you could define "Alias" Directories to eliminate this. I was wondering if something like this exists for Visual Studio aswell. Maybe namespaces?
Now if I start editing the newly created files I loose Intellisense.
If I uncheck "Show All Files" I get it back. Does anyone else have the
same problem?
I have faced the same issue as you described and when I migrate a file to another folder under the Show All Files filter, Intellisense does not work, which is really strange. When I didn't migrate the file, Intellisense works well at the default address.
And I have reported this issue on our DC Forum and you can add any detailed info on that link and also anyone who is interested in this issue will vote it so that it will make Microsoft attach great importance.
The workaround is that you should uncheck Show All Files and then click it again. After that, Intellisense will turn back and works well.
Another question I wanted to ask was about filter files and project
folder structure. Should I use the filter files to organize my project
or an actual folder structure? I'm slightly confused because of the
Intellisense problem, that's why I'm asking.
Actually, when you use the default project type in c++ projects(not click Show All Files), this structure will automatically identify each file in your project and categorize it into its own filtering folder. At this time, the intellisense works perfectly, because subdividing various files will not conflict.
But in this format, you cannot create folder structure.
Besides, using the filter files or the actual folder structure are the same effect. If you use actual project structure in the Windows Explorer, it will be showed under solution explorer(click Show All Files) automatically.
Suggestion
As long as you do not want to migrate files at will, you can use Intellisense under this filter.
Or
1) create folder structure under Show All Files and then uncheck Show All Files to get Intellisense.
And if I should create a folder structure, how should I handle
includes like this #include "....... \FileUpInTree.h". In Javascript
and Webpack you could define "Alias" Directories to eliminate this. I
was wondering if something like this exists for Visual Studio aswell.
Maybe namespaces?
I think you do not need to worry about this too much.
When you want to use the file under the folder structure of the project, you can just use #include"xxx.h" and the Intellisense will automatically grab the header file in the project.
And if you want to reference a c++ class, you can just use namespace <the c++ class namespace>.

I have problems with sqlite3

I'm pretty new to programming and i have never made any big project. Currently I'm learning c++ language and I want to learn sqlite3 to store data in this database.
My problem:
I don't know how to #include "sqlite3.h". I have downloaded source code from sqlite website and added files into my visual studio 2012 project and then tried to include, but it didn't work:
Error: "cannot open include file 'sqlite3.h': No such file or directory...
So yeah.. its totally noob question^^ I cant make sqlite3 to work in my visual studio project if you know what I mean.
You have to make sure that you update your project settings to include the path to the files you downloaded. simply go to the project settings, C/C++ general properties and look on the right for "Additional Include Directories". You probably need to update the path to the lib files as well.

Visual Studio 2010 new C++ project from existing code

I want to modify an existing project but put all the source and header files etc. into a new directory to keep them separate. When I use the "create new project from existing code" option, the solution files seem to point back to my original .cpp file which I don't want.
Q - what the best way to do this?
The Visual Studio projects are simple XML files that can be edited. Just bulk replacing the paths in your favorite text editor is probably the easiest way to go (I do that all the time).
create a new project, without opening the existing one.
then copy all the header and the cpp files from the older folder to the new project folder.
'add existing item' will only point to the original file only.