I'm on a Windows, using c++17 and trying to use GLFW in one of my projects. This is what I tried, yet it doesn't work:
I opened up an empty folder in VS Code, and added src and Dependencies folders. Then downloaded the GLFW pre-compiled binaries. I created a folder inside Dependencies for GLFW, then pasted the include and lib-vc2022 folders from the pre-compiled binaries inside it.
Then I opened c_cpp_properties.json from inside the .vscode folder in the workspace and added ${workspaceFolder}/Dependencies/GLFW/include/** in the "includePath" list.
I ran c++ code which started with #include <GLFW\glfw3.h>. I got this error:
App.cpp:2:10: fatal error: GLFW\glfw3.h: No such file or directory
2 | #include <GLFW\glfw3.h>
| ^~~~~~~~~~~~~~
compilation terminated.
I followed a tutorial I found all throughout this, and tried others. Still cannot get it to work. Does anyone know why?
Just remove ** from path: "${workspaceFolder}/Dependencies/GLFW/include"
Related
I am trying to learn meshing algorithm for CFD puposes and I found CGAL to be a good library to learn everything from ground. My vcpkg cgal[qt5] installation failes due to some problem in installing boost. But other library installation works. I also tried to follow this tutorial but OpenGR and libpointmatcher library generation fails and results cmake error. So I have to setup everything manually. I am using Visual Studio 2022 and Qt5.15.2. I have qt extension downloaded and configured in visual studio. I have also QTDIR variable created in enviroment variables and Qt bin directory in system path.
What I did is as follows-
(1). first I created an empty console application called polygon and added various example code provided by cgal as a source and configuration x64, Release. changed
(2). created a folder library inside solution directory and extracted downloaded cgal-5.5.zip(has include, data, demo, etc ....) to library directory and added $(SolutionDir)library\cgal-5.5\include to additional include path in property manager.
(3). downloaded boost_1_80 from boost.org and compiled with the foolowing steps-
.\bootstrap
open project-config.jam and add-
using mpi ;
using python ;
run the command-
.\b2 --build-dir=build\x64 address-model=64 threading=multi --stagedir=stage/x64 --toolset=msvc -j 16 link=static,shared runtime-link=static,shared --variant=debug,release
added the boost_1_80 folder in include path and stage/x64/lib to additional library directory.
(4). I have built gmp and mpfr with vcpkg with .\vcpkg install gmp:x64-windows-static & .\vcpkg install mpfr:x64-windows-staticcommand and copied the folders gmp_x64-windows-static and mpfr_x64-windows-static to the library directory. I added include and lib folder of both library to respective path and in linker->additional dependency included the two lib file gmp.lib and mpfr.lib
(5). copied images, meshes, points_3 folder from data to solution directory
I can add eigen3, zlib to my project using the same process and all the examples I tried depend on the above libraries compiled and ran properly.
The problem comes when I try to do examples involves qt5. For example program draw_polygon.c-
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/draw_polygon_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polygon_2<K> Polygon_2;
typedef CGAL::Point_2<K> Point;
int main()
{
// create a polygon and put some points in it
Polygon_2 p;
p.push_back(Point(0,0));
p.push_back(Point(4,0));
p.push_back(Point(4,4));
p.push_back(Point(2,2));
p.push_back(Point(0,4));
CGAL::draw(p);
return EXIT_SUCCESS;
}
I tried following this tutorial but it's made for older version of Qt(Qt4) and Qt5 does not have Qt folder(..\path to\Qt<QT-version>\include) inside includes. This program does not any form file but I added the rest of the includes and lib files accordingly. When I try to compile, it says CGAL_USE_BASIC_VIEWER not defined. Given in this article if I write #define CGAL_USE_BASIC_VIEWER before the includes the generated are like -
Then I tried doing from qt empty project in visual studio interface which still gives -
Obviously my linking failed. How do I fix it for my case? I have went through several other articles none had definite answers.
I have the following problem:
I try to start coding C++ for a little project in my company. Therefore I received a precoded program. Since I am new to C++ i thought about using a IDE, CLion in my case. The precoded program was build with vim at the console (I don't know if this is the reason for the following, I guess building/linking, problem)
My folder/file structure looks like this:
src
|_subprogramA
|_src
|_main.hpp
|_main.cpp
|_ ...
|_subprogramB
|_ ..
|_src
|_...
...
|_libhttp
|_src
|_http.hpp
|_http.cpp
|_ ..
CMakeList.txt
In my CMakeList.txt, the paths to all .cpp and .hpp files are set by set(Source_Files ) add_executables(projectname ${SOURCE_FILES})
When i build subprogramA, i get the errormessage: fatal error: http/http.hpp: No such file or directory. It is included by #include .
Why does the compiler not find the http.hpp file in libhttp/src/http although it is specified in CMakeList? Is there a way to tell it where it is located except changing the "include" to the full path: #include libhttp/src/http.hpp or #include ../../lib.. and so on? (I do not wanna change this codepath since it is used by other persons in another company)
I wounder that i can run the tool via console but i cant build it with clion IDE.
Best regards, I am happy for every help. And sorry if the question is kinda stupid but starting c++ with a kinda big precoded tool without IDE seems to be impossible for me ^^
Frank :)
I'm trying to figure out how to use Xcode's "External Build System" project template to do some C++ coding. I've set it up with a very simple test project, just to make sure that I understand the configuration. I'm using make to build the project. When I try to run it, the build fails with the error message 'wchar.h' file not found.
Here are the steps I took to set up the project:
Create a new Project, using the Other -> External Build System template.
Set the Build Tool option to /usr/bin/make.
Copy my source file, ex_3_4.cpp to the directory where the Xcode project is located, and add it to the project using the Add files to "TestProject"... menu option.
Copy the makefile to the directory where the Xcode project is located.
Everything works if I run make from the terminal - I get an executable that runs fine, and there is no trouble finding wchar.h or any other headers. So I know that this is a problem with something in the project settings.
Here is the code in the source file:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!\n";
}
And here is my makefile:
all:
clang++ ex_3_4.cpp -o ex_3_4
clean:
rm ex_3_4
I can't find any place in the project settings where I can specify a search path for the wchar.h file (or any other header files for that matter), so I'm not sure how to fix this. I feel like it must be something simple.
If it makes any difference, I've been using Xcode 7.3, but I've also tried it with the new Xcode 8.0. I get the same error message using either version.
Perhaps you want to add a library target to your project, add it as a dependency on your project and then, your .h into the Headers section
I'm a bit of a novice at C++ development. The goal is to download an correctly ready a new package so that Cygwin will understand the statement #include "pcap.h". The directions for the developer package for WinpCap were pretty straight forward:
Download the ZIP archive containing the developer's pack
Uncompress it to the desired folder
Developer Package Instructions Link
The part that I am having trouble with is the "desired folder" part. I found the path for where Cygwin is storing default libraries which for me is C:Cygwin64/usr/include . I placed the package in this directory but that didn't work. pcap.h is nested in the unzipped folders two or three directories in. I noticed that this is a little different when compared to the directories that were there by default. To test whether or not this was correct or not I simply did an #include "pcap.h" statement in a .cpp file that previously compiled with no issues. With the new included statement I got a
fatal error: pcap.h: No such file or directory
from Cygwin.
How should I go about solving this? The goal is to have this behave like any other directory one would want.
You could use this to find where gcc searches for the header files.
`gcc -print-prog-name=cc1plus` -v
The result of the command in a Cygwin console :
$ `gcc -print-prog-name=cc1plus` -v
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/i686-pc-cygwin/4.9.2/../../../../i686-pc-cygwin/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++
/usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/i686-pc-cygwin
/usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/backward
/usr/lib/gcc/i686-pc-cygwin/4.9.2/include
/usr/lib/gcc/i686-pc-cygwin/4.9.2/include-fixed
/usr/include
End of search list.
You could still maybe place your package's headers in one of them.
I'm trying to get go-gl to work on windows. I've downloaded mingw and I've installed glfw according to this question (I put the dll in System32).
I download triangle.go from the examples github and setup this folder structure on my desktop:
/gocode
/src
/gogltest
triangle.go
I set the gocode folder as the gopath, I cd into gogltest and run go get. It downloads the files into gocode/src/github.com/ and I get this output:
# github.com/go-gl/glfw3
..\github.com\go-gl\glfw3\clipboard.go:4:24: fatal error: GLFW/glfw3.h: No such
file or directory
//#include <GLFW/glfw3.h>
^
compilation terminated.
# github.com/go-gl/gl
In file included from ..\github.com\go-gl\gl\attriblocation.go:7:0:
gl.h:2:21: fatal error: GL/glew.h: No such file or directory
#include <GL/glew.h>
^
compilation terminated.
What am I missing that will make glfw work for me?