#include <atlbase.h> not found, file exists - c++

When using Visual Studio 2012 creating an MFC project is possible but it cannot be compiled. All the ATL-headers cannot be found. For example if i create a simple dialog based MFC application and i compile it as it is from the project creation i get that atltrace.h could not be found (included in afx.h).
So i searched my filesystem for atltrace.h and found it in "$(VCInstallDir)atlmfc\include\atltrace.h". Knowing that i searched the VC++ Directories in the project properties. For the include paths it says "$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);". So obviously the folder where atltrace.h is contained is a system include folder for the project and the file exists there. Even though #include results in an error that the file does not exist.
Does anyone of you know why this happend?
Thanks in advance and greetings
Muepe

Related

how to link Qt with a visual studio c++ application project?

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.

Using header files with multiple projects in same solution

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.

Linking to Boost in DLL file

I've created a Win32 DLL application that links to the Boost Library. It compiles, and all is well and good, except that if I create another application that references the DLL, it requires that that application link to Boost as well. If I don't link to Boost, I get a "fatal error C1083: Cannot open include file: 'boost/utility.hpp': No such file or directory." Is there any way around this? I'm a noob, so I feel that I may be missing something essential, but I haven't found anything in searching yet. Thanks!
As Biffen said in the comments, that is a compilation error. You project needs to be able to read the Boost header file(s) that your other project used, so you'll have to edit your project settings "additional include directories" so that the location of the Boost header files is accessible.

Visual Studio 2010, C++, Cannot open include file: 'base.h'

I'm trying to build a project in Visual Studio 2010. But I get the following error:
fatal error C1083: Cannot open include file: 'base.h': No such file or directory
This is a part of the code from (stdafx.h) generating the error:
// from Base project
include "base.h"
include "basic.h"
include "logfile.h"
It seems that the project uses "MFC Microsoft Office Fluent User Interface (the "Fluent UI")".
Do I have to install anything else than Visual Studio for using it?
Something that is missing, that generates the error?
I'm quite new to C++ and Visual Studio.
EDIT:
The problem is that I can't find the files: // from Base project #include "base.h" #include "basic.h" #include "logfile.h" And I don't really know what they are for. I guess some MFC stuff? And they are not anywhere on my disk.
I'm using Windows 7, I don't know on which OS the project is developed on. Can it be that it's developed on WinXP for instance? In that case, do I need to install the SDK for WinXP?
The Fluency UI is part of a MSVC++ feature pack, which you will have to install on top of Visual Studio (you can dowload it following the links in the given page).
In particular the error is due to the fact that the compiler cannot find the file base.h, which could be because it is part of the above mentioned feature pack (and thus it is currently missing) or (if the file does exist on your computer) because your include path (the path the compiler consults for finding included files) is set up incorrectly
Make sure base.h available in the working directory
Right click the base.h (From code editor) and click open document in the context menu (first menu item)
Search that file in your project root folder, then make sure that the path for the file is available in the additional include directory. Project property page --> Select C/C++, first entry on the right side grid.
The problem with this was missing files in the project. Thanks for the help.

How do I create a C++ library in VS 2008?

I am working in VS 2008 and have several C++ projects and want to build my own library to share across projects. The first project is called "Project 1".
I created the library as a separate Win 32 project, and chose DLL. I added a reference in Project 1 to the library using "Add reference". I also added an "Additional reference search path". I added #include "Library.h" to the top of the cpp file for Project 1.
However, I am getting the error: fatal error C1083: Cannot open include file: 'Library.h': No such file or directory.
How do I do this?
Thanks!
In Visual C++'s terms, referencing a project does not add it to include search path (this is a paradigm shift from .NET). Because in C++, include can do all sorts of things -- you can even #include <not_even_a_c_file.txt>, for example.
Anyway, the quick solution for you is to also add the include path to Project 1. You can find it under Project Properties > C++ > General. You need to add the path to Project 2 under "Additional Include Directories".
If the projects are in separate folders, you may have you do something like:
#include "../libproject/Library.h"