I am trying to build QtDropbox to use in a project of my own in visual studio. QtDropbox uses Qt of course and I included it into the project (as you can see on the image).
My problem is that it cannot find #include <QLocale>. So what dependency did I forgot?
In order to let your compiler find the mentioned include file you have to extend the list of Include Directories in your Visual Studio project's configuration. The mentioned file can be found in QtCore sub directory of Qt include files, so you simply need to add C:\Qt\5.4\msvc2013_64\include\QtCore path to the list too.
Related
I want to use ch.h file from chibios in my project. The embedded project is created and is using HAL drivers for stm32. I want to find a way to add or import chibios library to the current project.
My question is that
how can I add these embedded libraries with lots of dependencies by visualGDB in visual studio?
Do I need to create .lib files of chibios?
What are the differences between C/C++ paths and linker paths?
Adding .a and .h files is enough or do I have to look for other files?
There are 3 ways that I followed and it wasn't successful.
I followed the link to add the paths.
The files that added to projects are libch.a and ch.h. It is called other header files inside ch.h. Then, I added the other header paths to C/C++ "additional include directories" too. After I added the third header file, I got the error "redefinition".
The second way, I wanted to use vcpkg, a library manager. But the chibios library wasn't available in vcpkg.
One another way is to add libraries in standard libraries without adding any paths. But how can I find standard libraries? If the location is in the compiler (gcc-arm-none-eabi), the chibios package was added, but it still wasn't detected in visual studio.
I really appreciate it if you know any tutorials or ways to add chibios in the visual studio
I have Qt 5.12.0 in a folder.
I need to create a dll and/or a bin project that can connect with a QML program.
My problem is that the vs project can't find the Qt files I need.
#include <QGuiApplication>
does not work.
This topic is the continuity of this one
How to link libraries to a project on visual studio? where I shared my problems with linking my dll with my bin project and to link Qt.
So I use a batch file to set the environment variable before launching visual studio. I use these variables to get the path to the Qt include folder, Qt lib etc.
Here is what I tried.
include the directory that contains the headers I need (I guess) :
configuration properties -> C/C++ -> General -> other include directories ->$(QT_INC)/. QT_INC is the path to the include folder. I also tried to write $(QT_INC)/* and $(QT_INC)/QtGui/. In any case,
#include <QGuiApplication>
couldn't compile.
i also added the path to the library folder :
linker->General->Additional library directories->$(QT_LIB)/
and some lib files in :
linker->entry->additionnal dependencies->Qt5Quick.lib;Qt5Gui;lib;Qt5Core.lib
none of these steps creates any error. It just doesn't help to find QGuiApplication.h nor QObject or anything I need.
I know my paths are correct and that using the environment variable like this works as I linked my dll using this method, and because wrong paths generates errors.
How to add Qt to my solution or to a project ?
thanks in advance
It works. The path was incorrect. There were "/" instead of "\" I think. And a synthax error in the batch file.
It's possible to add the header files of Qt by including the path in the properties.
include just the directory include of the Qt folder. Then, include headers again and again until all the errors are gone.
only for QGuiApplication, I need to include this
#include <QtGui/qtguiglobal.h>
#include <QtGui/qcoreapplication.h>
etc. all the includes of the beggining of QGuiApplication.h actually
here is the link to my other post I made about linking Qt to visual studio. How to link libraries to a project on visual studio? The problem was about the path to the dll.
I'm trying to add the Boost C++ Libraries to my C++ project created with Visual Studio 2017.
I have followed the instructions here.
When that didn't work I tried the advice in this post. Neither solutions worked for me.
What I have done:
Downloaded boost_1_69_0-msvc-14.1-64.exe from this precompiled boost libraries page
Installed to D:\local\boost_1_69_0
In my project I added D:\local\boost_1_69_0 to Properties > VC++ Directories > Include Directories and added D:\local\boost_1_69_0\lib64-msvc-14.1 to Properties > VC++ Directories > Library Directories
I have my project set to x64 and the above settings were set in the x64 configuration
When I try to build my project I get this error:
Error C1083 Cannot open include file: 'boost/regex.hpp': No such file or directory
Which points to this line of code in one of my .cpp files:
#include <boost/regex.hpp>
Please go to D:\local\boost_1_69_0 folder and see if you have a sub-folder named include in there. If you do, then instead of D:\local\boost_1_69_0 you need to set D:\local\boost_1_69_0\include in Properties > VC++ Directories > Include Directories
In other words, try to find the file you are including on your hard drive. Look at the full path to the file. Compare that full path with the path you added to the list of include directories (Properties > VC++ Directories > Include Directories) concatenated with the relative path you provided just before the filename in your include directive (boost). See if the two are the same.
If that does not help, then make sure you changed list of include directories for the same build configuration as you are attempting to build (if you build Debug, make sure you changed configuration for Debug too). Since VS 2015 IDE stopped making sure the two are selected in sync, which is annoying.
If your files are copied, then you have to compile the regular library.... If the same version of the compiler copies the machine.
Found out it was failing because I had included the same .cpp file which has the boost include into my unit test project which did NOT have the Include/Library folders set. The settings in my original question work now.
I'm using C++ and visual studio 2015. I've created 2 projects in 1 solution. The first project is a static library and the other a DLL. I want to include one header file from the static library to use it in the DLL. I tried specifying the path to the header file with - Project->Properties->C/C++ -> General -> Additional include directories but it doesn't work. When I try to include the header file I get a red underline saying "cannot open source file "SomeHeaderFile.h".
Thanks for the help.
Thanks for the tips but I found out how to make it work. The DLL is in a extra folder. All I had to do was #include "../../TheHeaderFileThatISpentHoursTryingToGet.h". I deleted the reference in the additional include directories path and it still works. I always thought that it made sense for files from different projects in the same solution to be accessible throughout all the projects. Thanks again.
I am a beginner on C++ and trying to learn about including libraries, and I haven't found documentation about it.
What are the ways of including libraries to a C++ project (Visual Studio). How do I implement them and which is the best way?
I was trying to include the SQLite library to a project. I tried to:
Include the header file in the include folder of the Visual Studio installation folder. It did appear in the External dependencies of my project, so I can do #include <sqlite3.h> without problems, but I don't know where I should put the implementation (a C file) and how to link it (is it in the linker>Input>Additional dependencies?).
Is it necessary that in order to include a library the file should be a .lib? Because I can't find the .lib for SQLite 3, do I have to include it in the lib folder of my Visual Studio installation?
Note: I am interested on the management of including a library in general. The SQLite 3 part is only because I took it as an example in order to learn how to add them.
A library is added in two steps
Adding headers path to the project
Adding .lib reference
In the first step, you must specify in the project where library headers are header. Usually, the path is specified in the project properties -> C++ -> Additional include directories, and them including files with relative paths.
In the second step you must specify in properties->linker the path where libraries (.lib) are located and the name of the library. With this Visual Studio is able to link the project properly.
go to project add existing item you must then select from the browse screen the .lib file you wish to add. and BINGO it is there!
best wishes
david