Creating an sqlite3.lib file / using sqlite3 in Visual Studios [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I can't for the life of my get this code to compile. I have it running fine on all other computers, but I had to switch to a windows machine and I am attempting to add sqlite3 back to the included header files and it is nothing short of a nightmare.
I have downloading the proper files, installed it correctly, the header file is being found in Visual Studios, but I am getting a ton of unresolved externals. I found that I need to create the .lib file myself and then I should be all set. I went ahead and tried using the LIB.exe included within Visual Studios on the .def file ( I have the .def, .dll, .c, and .exe file), and I get the error that it is unable to open sqlite3.lib. Am I using the wrong command or something? I have spent hours looking it up and I believe I am doing it correctly.
My command is LIB /DEF:sqlite3.def
Should I be using something else? I do not have any object files, just the def file.

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.

Related

How do I properly compile and link a resource file using MSVC command line toolchain? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I am a beginner to Windows API, and trying to learn how to make applications and such. I got to this part in the winprog.org articles, where the author started using resource files. I have written the resource file, in the .rc format. I compile it using the rc command, and it compiles into a .res file. Then I pass it off to the linker along with the the main object file, again, all from the command line. But when I run the linked executable, it does not show me the menu I defined in the resource file. Nor the icon I specified in there.
I am using Visual Studio Code instead of Visual Studio, partly to get comfortable with the MSVC CLI, and partly because I just like VSCode better. I also don't want to install additional C/C++ compilers when I already have MSVC.
So,
How should I go about compiling and linking the resource file correctly?
Are there any more up-to-date and not nightmarish methods to learn how to work with the Windows API?
You compile the resource script using the Resource Compiler (rc.exe) and pass its output on to the linker. There is no other magic involved.

How to compile and run a C++ open source program? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
This question may seem stupid, but as a beginner I did encounter this question when I moved forward, and I couldn’t find any information.
https://upload.cc/i1/2020/12/30/rUEC9s.png
https://upload.cc/i1/2020/12/30/d7Gwbr.png
https://upload.cc/i1/2020/12/30/6vr3lQ.png
This is an open source C++ program, I tried to compile and run it, but it failed
I have the following confusion:
Why the program does not have main.cpp
Update: When asking the first question, I even forgot helloworld.cpp, sorry
How do I compile and run it with CLion
Update: Usually I create a new project. After I create the project, it seems that it can be compiled and run for granted, but I don’t know how to compile and run an existing project (from others).
What do the folders in the first picture usually refer to
What does cmake and CMakeList.txt mean?
This open source program calls opencv, fftw and other libraries. I downloaded the corresponding files on the official website. How should the program call these libraries next?
If I download the library package on the official website, how should I install or configure it; if I install the package using homebrew, does that mean I have already configured it? Or I just finished downloading
I have written some programs in c++ and qt, but I don’t seem to know anything about c++
Finally, there is really nothing in the readme of this project
Your questions are too broad. Generally speaking, the answers would be something like this:
Naming your main file main.cpp is a convention, but is not required. What is required is a main() function (More info here).
You have to configure CLion to open Makefiles. There is a tutorial in CLion's website (Here).
What documents do you refer to?
src: Naming convention to the folder where the source (.cpp) files go.
include: Naming convention where the header (.hpp) files go.
License.txt: Where the software's license is written.
readme.md: Document that gives information about the project.
tests: Files to test the software.
cmake is a tool designed to build and package software (Their website is here). CMakeLists.txt is the file CMake uses to know how to create a Makefile and build the program.
You have to make the system know where the libraries are. You can achieve this by adding them to the project's folder or by adding them to the PATH of your compiler.
If you don't know very much about of C++ you should probably search a good C++ textbook. However, remember that Makefiles and C++ are 2 completely different things.
Most open source programs have build instructions somewhere in the readme.
It is usually best to follow those, even if they require downloading unfamiliar tools.
If the project doesn't have (detailed) build instructions, you should ask the owner, to add (more detailed) build instructions(by for example creating an issue for git-based repositories).

How to compile code from other compilers in VS 2017 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have downloaded a source code and can't get my head around to how can I compile it/open it in VS 2017. It should have been straight forward but nothing worked until you create a new project. If I just open a C file in VS, it just show me the file and there's no way to run it. Imagine I wrote a simple Hello World in C and I have its C file. How could I open and run it in VS? The only way I found was to create a new project and copy/paste the code from my C file into the newly generated file by VS. This gets extremely inefficient with large projects having multiple C/h files :/
Yes, you should Create a New project -> Visual C++ -> Empty Project. After that, you will see in the solution explorer (Resource files, Header files, and Source files) folders. Right click on Header files and Then Add -> Add existing items, Then you can select multiple header files. Follow for source files same as header files that you Added

Editing this Qt program (C++) I think [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am working on a raspberry pi project that I have picked up from a previous groups work.
It seems that the program used to control the raspberry pi has been compiled and we can run it fine, however there is no original source code (C++) or any project files for Qt as far as I can see, below is a copy of the folder, is there any way to get at the source code using Qt or something else?
We want to be able to make changes to the program.
There is no documentation on the build of the software, only indication on how to run it which we can do fine, I am trying to track down the authors but to no luck.
What can I try? I tried opening the files here with http://codelite.org/.
All of the object files and the turbo_gui file just contain one line: ELF SOH SOH SOH
On the image you posted, the directory is a Qt build directory, not a source directory.
The folder you showed contains some source files automatically generated by Qt, some compiled .o files and a linked binary, but not the original source code.
If the authors didn't publish the original C++ source code, there is no way to get the exact source code back. You should ask the authors to send you a copy of the source code.
If there is no way to get the source code, the best you can do is use a disassembler or decompiler (such as Hex-Ray's plugin for IDA) to get an idea of how the code works, then reimplement it yourself.

Output Directory in Visual C++ 2010 IDE [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I’m using the MS Visual C++ 2010 IDE on Windows 7 to compile C++ code.
I need to install the compiled code in a specific directory (C:\Users\username\somefolder). What is the best way to set this output directory?
I ran Visual C++ as administrator, opened my *.sln project, checked the expert settings and browsed to the path in the Output Directory of the Configuration Properties. Unfortunately, the code did not build in the right directory but under Program Files (probably because Visual C++ starts at an other directory for the specified relative path). Copying the absolute directory does not work.
Could someone point out how I should change this output directory in C:\Users\username\somefolder?
In the project file I can only find an 'OutputDirectory', not an 'OutputPath', so I did not risk to change this yet as I am a novice Visual C++ user.
EDIT: replacing the 'OutputDirectory' did not work or I made another mistake (cf. comments).
I would not like to move the compiled code every time I rebuild it.
Thank you in advance for the help!
The best way is to leave the compiler to build in its usual relative subdirectory and then to copy the bits you want copied in a post-build step.
This way you will always get a good build, even if the destination directory doesn't exist (or whatever reason). It also means you can still copy the files elsewhere if you change your build system - eg you build on a server that does CI for you.
Also - always specify username as the environment variable path, not a fixed user or no one else will be able to build your project successfully.