Can't Include Qt's Include Files - c++

I want to learn Qt in C++ (using VSCode), but I can't because of this single problem.
I have tried:
Putting the include folder in c_cpp_properties (C:/Qt/6.3.1/mingw_64/include)
Putting INCLUDEPATH += C:/Qt/6.3.1/mingw_64/include in the project file (.pro)
Using /i compiler flag
If I run the file in VSCode (through code . from the developer command prompt for VS 2022), the error is:
C:\Users\<Name>\Pins\Codes\C++\testing.cpp(1): fatal error C1034: QtWidgets: no include path set
But if I run the file in the developer command prompt for VS 2022 (the compiler is in there), the error is:
testing.cpp(1): fatal error C1083: Cannot open include file: 'QtWidgets': No such file or directory
Code:
#include <QtWidgets>
int main() {
QWidget window;
window.resize(640, 480);
window.show();
}

Check include folder. I guess "QTWidgets" library can be found in its own folder or "Lib" folder, not in "include" folder.

Related

gtk/gtk.h: No such file or directory, on Windows, using VS code

I try to compile a cpp file with this header:
#include <stdlib.h>
#include <gtk/gtk.h>
I work with MSYS2, so both the compiler and the gtk library are installed through it. The cpp compiler path is:
D:\msys\usr\bin\cpp.exe
and here is the VS code include path additions, which I supplied to the IntelliSense Configurations page under "include path":
D:\msys\mingw64\include\gtk-2.0\**
D:\msys\mingw64\include\**
D:\msys\mingw64\lib\**
D:\msys\usr\include\**
and I have gtk etc. in the include folder. I actually installed three different versions of gtk, 2-4.
Before I added them to the include path, I got an error like "cannot open source file", and after adding them I get the
fatal error: gtk/gtk.h: No such file or directory
error. gtk/gtk.h is located just inside gtk-2.0. What am I doing wrong?
Thanks a lot.

glfw/glfw3.h': No such file or directory

When trying to run a Vulkan project in VS 2022 on Windows 11, it just throws this error:
fatal error C1083: Cannot open include file: 'glfw/glfw3.h': No such file or directory
In the main .hpp file, I use:
#include <glfw/glfw3.h>
The Configuration Properties->C/C++ Additional Include Directories has this line:
C:\Users\Me\OneDrive\Documents\Coding\Libraries\glfw-3.3.5.bin.WIN64\include
The glfw3.h is located at:
"C:\Users\Me\OneDrive\Documents\Coding\Libraries\glfw-3.3.5.bin.WIN64\include\glfw\glfw3.h"
Any idea on how to solve this issue?

Unable to include Magick++.h for image processing: "no such file or directory"

I'm setting up a c++ visual studio project to use ImageMagick's api, Magick++, for image processing. However, when I try to include <Magick++.h> in the only cpp file in the whole solution/project, I encounter this error:
fatal error C1083: Cannot open include file: 'Magick++.h': No such file or directory
I tried right-clicking Magick++.h in my code and pressing open document <Magick++.h>. This lead to an error message, which says the file is not found in current source file's directory or in build system paths. However, in the error message, the Build System Path clearly says the path to the include directory.
I have:
added the include directory of ImageMagick-7.0.9-Q16 in the project's properties->C/C++
->Additional Include Directories.
added the lib directory of ImageMagick-7.0.9-Q16 in the project's properties->Linker->Additional Library Directories
added CORE_RL_Magick++_.lib, CORE_RL_MagickCore_.lib, and CORE_RL_MagickWand_.lib in the project's properties->Linker->Additional Dependencies
Made sure everything is x64
Set the configuration to release
I somehow made Magick+++_demo project, the one that comes with magick++, work after tinkering with the settings. However, I cannot make other projects/solutions work. I have checked the settings of the demo project and tried to replicate it in my project where appropriate, but I cannot make my own project work.
this is the only code:
#include "pch.h"
#include <Magick++.h>
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
}
I have been googling and trying to make this work for the last 6 hours. Any help is hugely appreciated.

cannot include header on linux subsystem with vs2017

I want to use C++ OpenCascade (OCE) libraries within a C++ program with vs2017 inside a linux subsytem (ubuntu) from windows 10.
I compiled OCE into the linux subsystem; I also have the OCE compiled binaries in windows.
When I try to include a header from OCE in my code (#include <Adaptor2d_Curve2d.hxx>), I get this error :
error : Adaptor2d_Curve2d.hxx: No such file or directory
error : #include <Adaptor2d_Curve2d.hxx>
error : ^~~~~~~~~~~~~~~~~~~~~~~
error : compilation terminated.
I added OCE include path in my vs project in additional include directories from using $(ProjectDir) or $(RemoteRootDir) path. I checked, the paths are corrects.
I have created a linux console application.
My code :
// from oce
#include <Adaptor2d_Curve2d.hxx>
int main()
{
printf("hello from CAO3DConverterTestApp!\n");
return 0;
}
I've added theses lines into Additional Include Directories in my project settings
$(ProjectDir)..\oce-0.18.3\include\oce
$(RemoteRootDir)..\oce\build\inc
So what is the procedure to add external libs and headers in C++ code using vs2017 in linux subsystem from windows 10 ?
Here is a minimal projet with Boost dependancies instead of OCE
build a c++ linux console app with vs2017, using ubuntu linux subsytem.
include boost headers path in Additional Include Directories from project properties
add #include <any.hpp> (header from boost) into main.cpp file
The -I statements are corrects -I "C:\<myPath>\dependencies\boost_1_68_0\boost\", but I still have the error
error : any.hpp: No such file or directory
error : #include <any.hpp>
error : ^~~~~~~~~
error : compilation terminated.
What else should I do ?
refs : https://blogs.msdn.microsoft.com/vcblog/2017/02/08/targeting-windows-subsystem-for-linux-from-visual-studio/
Can't really debug your project without a minimal example, but here is something that can help you figure out what is going on:
In VS2017 right click your project, select properties. Under C/C++ choose command line.
Here you can see the command line the IDE is using to compile your source files. Check all /I statements and make sure one of them points to where Adaptor2d_Curve2d.hxx is located.

c++" fatal error C1083: Cannot open include file: 'blabla': No such file or directory" only in Release Build

whenever I compile my project in the Release build I get this error:
Error 29 fatal error C1083: Cannot open include file: 'NX_Win32Wrapper.h': No such file or directory
I get another one just like this, just in a different file (the error complains about a different file). The file in the second error is whichever I included first (is on top of the include list), the same goes for the first error, but its right after:
(this is the "main".cpp file,where main() is and GameV2 is my project name
#include "stdafx.h"
#include "GameV2.h"
I know there is now code, but I think I'd have to post everything :P Do you have any suggestion what should I check?
It seems that you're using Visual Studio.
Check the include directories in project properties, for Release target. You set the proper include directories only for Debug target.
You should check the "Additional include directories" - the list should usually be the same for "Debug" and "Release".