473,326 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Why .cpp program does not see the GL/glew.h file?

In the directory where the program is located (C:\2022\Work\programming\engineering\my-works\my_game\programs), there is also the glew-2.1.0 folder, which contains the include folder, which contains the GL folder, which contains header file glew.h. When I try to run the program in Visual Studio Code 1.69 (Windows 10 Home), the following text appears in the terminal:
"PS C:\2022\Work\programming\engineering\my-works\my_game\programs> cd "c:\2022\Work\programming\engineering\my-works\my_game\programs\" ; if ($?) { g++ open_gl_1_test.cpp -o open_gl_1_test } ;if
($?) { .\open_gl_1_test }
open_gl_1_test.cpp:1:10: fatal error: GL/glew.h: No such file or directory
1 | #include <GL/glew.h>
| ^~~~~~~~~~~
compilation terminated.
PS C:\2022\Work\programming\engineering\my-works\my_game\programs>".

Here is the program code itself:

Expand|Select|Wrap|Line Numbers
  1. #include <GL/glew.h>
  2. #include <GLFW/glfw3.h>
  3. #include <iostream>
  4. using namespace std;
  5. void init(GLFWwindow *window) {}
  6. void display(GLFWwindow *window, double currentTime)
  7. {
  8.     glClearColor(1.0, 0.0, 0.0, 1.0);
  9.     glClear(GL_COLOR_BUFFER_BIT);
  10. }
  11. int main(void)
  12. {
  13.     if (!glfwInit())
  14.     {
  15.         exit(EXIT_FAILURE);
  16.     }
  17.     glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
  18.     glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
  19.     GLFWwindow *window = glfwCreateWindow(600, 600, "Chapter2 - program1", NULL, NULL);
  20.     glfwMakeContextCurrent(window);
  21.     if (glewInit() != GLEW_OK)
  22.     {
  23.         exit(EXIT_FAILURE);
  24.     }
  25.     glfwSwapInterval(1);
  26.     init(window);
  27.     while (!glfwWindowShouldClose(window))
  28.     {
  29.         display(window, glfwGetTime());
  30.         glfwSwapBuffers(window);
  31.         glfwPollEvents();
  32.     }
  33.     glfwDestroyWindow(window);
  34.     glfwTerminate();
  35.     exit(EXIT_SUCCESS);
  36. }
How to ensure that the program can include the glew.h header file?
Jul 24 '22 #1
1 9200
dev7060
633 Expert 512MB
In the directory where the program is located (C:\2022\Work\programming\engineering\my-works\my_game\programs), there is also the glew-2.1.0 folder, which contains the include folder, which contains the GL folder, which contains header file glew.h. When I try to run the program in Visual Studio Code 1.69 (Windows 10 Home), the following text appears in the terminal:
"PS C:\2022\Work\programming\engineering\my-works\my_game\programs> cd "c:\2022\Work\programming\engineering\my-works\my_game\programs\" ; if ($?) { g++ open_gl_1_test.cpp -o open_gl_1_test } ;if
($?) { .\open_gl_1_test }
open_gl_1_test.cpp:1:10: fatal error: GL/glew.h: No such file or directory
1 | #include <GL/glew.h>
| ^~~~~~~~~~~
compilation terminated.
PS C:\2022\Work\programming\engineering\my-works\my_game\programs>".
Use relative path with double quotes.
Expand|Select|Wrap|Line Numbers
  1. #include "../myglewfolder/include/GL/glew.h"
The project directory can also be added to the compiler include path.
Jul 26 '22 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ana | last post by:
Hi! I have problems with the following scenario: My application is developed using C# under .NET. It must run on all Windows versions starting from Windows 98. The user must open different...
6
by: Cyril Vi?ville | last post by:
As it's written in the subject, i would like to know how can i find which program modified a file (last access, last changed). By example: Example.txt in a log directory I need to know which...
2
by: Daniel | last post by:
Is there any way for System.IO.StreamWriter Write method to write out part of the string to file. such as if the machine is shut down half way through? or does the file not actually exist until the...
2
by: cj | last post by:
I want when someone clicks the X in the upper right corner of my program for it to run the sub I've put in for the exit item on the main menu (exitMenuItem_click)
3
by: Reggie | last post by:
I am writing a c++ program that will run multiple *.exe files and dump the results to a file. In my test case, I am using netstat. I am running netstat from my c++ program with the ...
13
by: James Reid | last post by:
I'm looking for the source code for a DOS command line c/c++ program that can change file associations. In other words it can cause any version of Windows to associate a particular .exe file with a...
5
by: sjayaramit | last post by:
hello friends, Is it possible to run a C program from a batch file. I use Dev c/c++ compiler and store the program in devc++/programs/examples/myprogram/one.c
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
1
by: Amrapali0917 | last post by:
Hello, A C++ / MFC program does not stop at breakpoints in any visual studio IDE but runs well. The project settings are ok as i have tried same program on different machines where it does stop...
2
by: Kreators | last post by:
Hi everyone i'm newbie here in bytes and a newbie in programing i need your help! can you correct my program when my program compile its say Process completed. but when i put a Word and Run my...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.