Cannot open include file: 'linmath.h' - c++

I have set up GLFW and GLAD in Visual Studio 2017 as follows:
I created in C: directory, folder GLFW-GLAD, and in V.S., Empty Project "Project-0" and Source file "Main.cpp".
1. In project GLFW-GLAD's "Properties", Configuration: [All Configurations], Platform: [Active(Win32)], Configuration Properties:
1.1. C/C++ > General > "Additional Include Directories" window > "C:\GLFW-GLAD\glfw\include" and "C:\GLFW-GLAD\glad\include".
1.2. Linker > General > "Additional Library Directories" window > "C:\GLFW-GLAD\glfw\lib-vc2015"
1.3. Linker > Input > "Additional Dependencies" window > "opengl32.lib; glfw3.lib; glfw3dll.lib".
1.4. Linker > System > Subsystem > Console (/SUBSYSTEM:CONSOLE)
2. In project folder "Project-0" I have pasted files: "glad.c" and "glfw3.dll".
I copied program from https://www.glfw.org/docs/latest/quick.html and pasted in Main.cpp code area. I attempted run it but failed. Output is
"fatal error C1083: Cannot open include file: 'linmath.h': No such file or directory"
Please help.

Add to project (by Solution Explorer > Source Files > Add > New Item > Header File) header file linmath.h. Go to https://github.com/glfw/glfw/blob/master/deps/linmath.h copy code and paste in linmath.h code area.
Delete glad.c from project folder and add it to project by Solution Explorer > Source Files > Add > Existing Item. Regards.

Related

Fatal error: stm32f4xx_syscfg.h: No such file or directory

I am trying to compile this code (https://github.com/cahya-wirawan/stm32f4-musicplayer) On my STM32F4Discovery board using Atollic True Studio. When I launch the debug of the main, I get this error:
../lib/driver/src/stm32f4xx_syscfg.c:50:30: fatal error: stm32f4xx_syscfg.h: No such file or directory
However stm32f4xx_syscfg.h is in the path /stm32f4-musicplayer/lib/driver/inc, so I think it's a path issue and I have to specify it somewhere. Any ideas?
Thanks
Check the project settings (right click on project -> properties -> c/c++ general -> paths and symbols). Ensure you're src/ folder is included here.

Qt : Unit Test with Visual Studio

I have a Visual Studio Project and want to write some Unit Test for it.
I tried doing that by using a "Native Unit Test Project".
The Problem is, that when I use a QString in the Test, the Test fails with following message:
Message: Failed to set up the execution context to run the test
Any suggestions how I can write Unit Test using Qt?
#include "stdafx.h"
#include "CppUnitTest.h"
#include <QtCore/QCoreApplication>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace Test
{
TEST_CLASS(UnitTest1)
{
public:
TEST_METHOD(TestMethod1)
{
QString a = "Test";
Assert::IsTrue(true);
}
};
}
I have tried with the above example of yours and i am able to compile the unit test. These are the following changes I've done apart from copying your code.
Check if your QT is built with 32 bit or 64 bit compiler.
You need to set the same in Solution Platforms.
You need to add include directory path and the lib file path(Qt5Cored.lib(for
debug)/Qt5Core.lib(for release)) in the Project properties.
To run the unit test you need to copy the
Qt5Cored.dll/Qt5Core.dll file in the folder where your unit test dll file is generated(After compilation).
PS:- I am using VS 2015 but this doesn't matter.
I have also ran into this issue with Qt6 with a project created using the Qt Visual Studio Tools extension for Visual Studio 2019.
QString was one of the things popping up as an error during the build process, but there was various more errors. My solution was as follows:
Gone to the Microsoft Unit Testing Framework for C++ project's Properties (right-click on solution, bottom option of the menu "Properties")
As mentioned in #sonulohani's response, I had it running in x64 by default.
Under Configuration Properties > Linker > General Additional Library Directories I added the path to my QT installation location libs folder (for me this was C:\Qt\6.1.2\msvc2019_64\lib) at the top of the list.
Under Configuration Properties > Linker > Input Additional Dependencies I added a link to all the "*.lib" files from that very same QT installation (for me, this was C:\Qt\6.1.2\msvc2019_64\lib\*.lib) AND a link to the build output .obj files for the Qt project ($(SolutionDir)<MY PROJECT NAME>\$(IntDir)*.obj where <MY PROJECT NAME> was my project name). This second part may not necessarily be needed.
Copying just the Qt6Core.dll/Qt6Cored.dll as suggested by #sonulohani did not work. It was still missing stuff. So in the properties, under Configuration Properties > Build Events > Post-Build Event Command Line I added this script to copy all the Qt6 dll files to the test project .dll output directory:
for %%f in (C:\Qt\6.1.2\msvc2019_64\bin\Qt6*.dll) do #copy /y %%f $(SolutionDir)$(Platform)\$(Configuration)\Tests\
Now at that point I had another issue, since both my test project and my actual Qt project was dumping its files into the same output directory, and the Qt project did not like having all those dlls in there and did not run anymore. So I created the $(SolutionDir)$(Platform)\$(Configuration)\Tests\ directory within the regular output directory, and also made this \Tests\ subdirectory the output directory for the test project (Configuration Properties > General Output Directory).

vcxproj additional include path that are not shown in the project properties

I changed the path of my VS2017 project. Despite the fact that I updated every additional or include path under my project properties, I noticed that inside the *.vcxproj file are exist some additional include directories <AdditionalIncludeDirectories> from my previous project path. These additional paths are not shown inside the properties manager.
For example additionalIncludePath inside vcxproj below, it belongs to previous project's path.
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;</PreprocessorDefinitions>
<AdditionalIncludeDirectories>D:\Software\hor_earlyversions\revision-1\source\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
I found also <AdditionalIncludeDirectories> under <Midl> tags.
So my questions are :
a) why I can not see them under project properties
b) do I have to delete them manually ?

Error while compiling in release mode

I'm building an IE extension (ATL) with VS2008 and somehow when I switch to release mode it gives me some linking error:
Error 2 fatal error C1083: Cannot open include file: 'ImplAddon.h': No such file or directory *************** 19 Engine
Error 3 fatal error LNK1181: cannot open input file '..\release addon\engine.lib' Addon Addon
I've tried to add to each of the projects in the "Additional include directories" in the project's properties the relevant path to 'ImplAddon.h' but nothing helps.
Any idea what to do??
Thanks a lot fellas :)
Right click each project and go to properties then top,left there is a drop-down to select the environmental. select all configurations there. then go to C++-> General -> Additional directories then add the paths of your header fails located at.

What files belong to a build target in CDT managed build?

In CDT's managed builder, how are individual files assigned to build configurations?
Specifically, how can I:
indicate that configuration A has to build and link sources from folders A and B, while configuraion B shall use folders A and C,
include sources (not headers) from a referenced project (or just any external source files?) to be also built and linked as a part of a given project?
1st point, assuming there are 3 folders A,B & C containing .cpp files, try this :
select folder C in the 'project explorer' pane, right-click > exclude from build... > check configuration A > ok
select folder B, right-click > exclude from build... > check configuration B > ok
This way configuration A will ignore .cpp files from folder C and configuration B will ignore folder B.
2nd point : maybe you could use import > general > file system to import source from an external folder into your project ?