Gl Glut.h No Such File Or Directory Dev C++yellowtickets



  1. Gl Glut.h No Such File Or Directory Dev C Yellow Tickets 2020

On This Page

Directory”,这是由于系统中没有安装OpenGL库导致的,于是在控制台中输入以下命令安装OpenGL库及其工具:apt-get install libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev 即可。 Qt编译错误“GL/gl.h:No such file or directory”的解决方法的更多相关文章. Apt-file update Now you can write a search to answer 'what package provides the gl.h file?' Apt-file search 'gl.h' I don't have an ubuntu box just now to check, but I'd guess the result will be something like mesa-dev or opengl-dev. Once you know what package provides 'gl.h', (let's pretend the result from apt-file is 'libmesa-dev'), install it.

A. Introduction

This document describes how to install SFML in Code::Blocks on a computer for the course CS-11: Introduction to Programming Concepts and Methodology, C++. SFML is a free and open source library that provides a simple object-oriented interface to graphics, sound and other parts of a personal computer. It has five main modules: system, window, graphics, audio and network. Since this is an introductory course, not all options are covered such as static builds.

  • This article looked at the 'No such file or directory' message of the GCC C compiler. If you get this message you should: Remember that the compiler is always right in situations like this.
  • Steps to Setup OpenGL (GLUT) in CodeBlocks: Step – 1. Download GLUT Library and unzip the file. Open include folder from the downloaded file; Copy the glut.h file and paste to the folder “C:Program FilesCodeBlocksMinGWincludeGL“. Open lib folder from downloaded file.
Directory

These instructions assume that you have already installed Code::Blocks as described in the document: How to Install Code::Blocks on Windows. If not, do so now.

Dev

For Linux computers, SFML installation is described in How to Install Code::Blocks and SFML for Linux. For Macintosh computers, SFML installation is described in How to Install SFML in OS-X.

B. Installing SFML

Dev

Follow these instructions carefully. Do NOT just continue without completely reading each step of the instructions carefully or you will probably not install the software correctly. If in doubt ask a classmate or the instructor to verify what you are doing.

If you cannot create an SFML project after installing, then you will need to reinstall Code::Blocks, SFML or both.

  1. In your CodeBlocks folder, create a new folder named 'sfml' (without the quote marks). You will install the SFML files into this folder.
  2. Go to the SFML download page and follow the link to the latest stable version.
  3. Download the binaries corresponding to the compiler Code::Blocks installed, which is GCC, the word length (32-bit or 64-bit) of your compiler, and the variant (SJLJ, DW2, SEH) with SJLJ preferred, like: GCC 5.1.0 TDM (SJLJ) - 32 bits.

    If unsure, look in your CodeBlocksMinGWbin folder and check which of the libgcc_s_XXX dll files were installed by Code::Blocks, where XXX are the letters in parenthesis. If you have multiple versions, choose the SJLJ variant of SFML.

    The binary for the classroom computers is: GCC 4.8.1 TDM (SJLJ) - 32 bits. Here is the usual file to select for the classroom:

  4. Unzip the downloaded file (see Windows unzip) and move (not copy) all the extracted SFML files and folders to the CodeBlocks folder named 'sfml'.

    Make sure you have the correct folder structure. Do NOT have any extra file folders like 'SFML 2.4.2' in the file path.

  5. Start CodeBlocks and click on the Settings->Compiler menu to open the Compiler settings dialog.
  6. In the Compiler settings dialog:
    1. In the left-hand menu, verify Global compiler settings is selected,
    2. Select the Toolchain executables tab.
    3. Select the Additional Paths tab.
    4. Press the Add button, find the bin folder of SFML (C:CodeBlockssfmlbin), and add it without keeping relative paths.
    5. Press the OK button at the bottom of the dialog.

    If you are reinstalling Code::Blocks, you may get a message, 'Path already in the extra paths list!' If so, click OK and continue.

C. Creating an SFML Project from the SFML Project Wizard

In this section we create a test project to verify the SFML installation. We can use these instructions as a starting point for other new projects as well.

  1. Run Code::Blocks and click the 'Create a new project' link or follow the menus: File -> New -> Project....
  2. Select the 'SFML project' wizard by clicking the SFML project icon shown and pressing the Go button.
  3. In the 'SFML project' start screen press the Next button.
  4. In the 'SFML project' version screen select SFML 2.0 as shown and press the Next button.
  5. In the 'SFML project' link library screen select Dynamic Link Library as shown and press the Next button.
  6. In the 'SFML project' name screen enter a project name where shown and press the Next button.
  7. In the 'SFML project' path screen set the path to the location you installed SFML ( C:CodeBlockssfml ) and press the Next button.
  8. In the 'SFML project' compiler configuration screen verify the compiler is the GNU GCC Compiler and press the Finish button. Leave the other settings unchanged.
  9. View the source code for the default SFML project file by expanding the Sources tree and clicking on main.cpp.
  10. Build the project by clicking on the Build icon in the toolbar, using the menus Build->Build, or pressing Ctrl+F9.
  11. When you build, you will see a pane at the bottom of Code::Blocks called Build Log. You should see an output like this showing the compiler did not report any errors:

    If you have problems, check the In Case of Trouble section below.

  12. Run the program by clicking on the Run icon in the toolbar, using the menus Build->Run, or pressing Ctrl+F10, and verify you see the following graphics window.

    If you have problems, check the In Case of Trouble section below.

  13. After closing the graphics window by pressing the red X, verify the message process returned 0 appears in the console.
  14. Click on the console and press the space key to close the console window.

D. Creating an SFML Project from Empty Project

In this section we create a test project to verify the SFML installation. We can use these instructions as a starting point for other new projects as well.

  1. Run Code::Blocks and click the 'Create a new project' link or follow the menus: File -> New -> Project....
  2. Select the 'Empty project' wizard by double-clicking the Empty project icon shown.
  3. In the 'Empty project' start screen press the Next button.
  4. In the following window, enter a project title and folder path and then press the Next button. The example project is 'test-sfml'.
  5. Continuing through the 'Empty project' wizard, verify the GNU GCC compiler is selected and then press the Finish button.
  6. In the Project menu, select Build options.... (If 'Build options' is grayed out, check to see if another Code::Blocks window is hidden behind the main window.) After selecting Build options... then:
    1. Click the global project name (like test-sfml) on the left-hand menu. The project name is what you entered in step 4.
    2. Select the Search directories tab.
    3. Select the Compiler subtab.
    4. Press the Add button, find the include folder of SFML, and add it without keeping relative paths. If you installed SFML to the correct folder, then you can use C:CodeBlockssfmlinclude independant of the title of your project.
  7. Similarly, set the Linker path to the lib folder (C:CodeBlockssfmllib) by:
    1. Clicking the global project configuration (project name) on the left-hand menu.
    2. Selecting the Search directories tab.
    3. Selecting the Linker subtab.
    4. Pressing the Add button, finding the lib folder of SFML C:CodeBlockssfmllib and adding it without keeping relative paths.
  8. Also in the Project build options dialog:
    1. Click the global project configuration (project name) on the left-hand menu,
    2. Select the Linker settings tab,
    3. Press the Add button and add the Link libraries in the order shown by typing the following names into the Add library dialog box:
      Do NOT find a file. Instead, type (or copy) in the names shown to the left one at a time and press the OK button in the 'Add library' dialog between each added name.

    The GCC compiler requires the link libraries to be in the correct order as shown. If you add sfml-audio or sfml-network, add them before sfml-window.

  9. When finished adding the project build options, press the OK button of the 'Project build options' dialog shown above.
  10. Add a file to the project by using the menus File->New->Empty file and choosing an appropriate file name like test.cpp.

    Read the dialogs and select appropriately. If in doubt, use my suggestions like test.cpp.

  11. In the file tab (test.cpp), copy and paste the following program code.
  12. Build the project by clicking on the Build icon in the toolbar, using the menus Build->Build, or pressing Ctrl+F9.
  13. When you build, you will see a pane at the bottom of Code::Blocks called Build Log. You should see an output like this showing the compiler did not report any errors:

    If you have problems, check the In Case of Trouble section below.

  14. Run the program by clicking on the Run icon in the toolbar, using the menus Build->Run, or pressing Ctrl+F10, and verify you see the following graphics window.

    If you have problems, check the In Case of Trouble section below.

  15. After closing the graphics window by pressing the red X, verify the message process returned 0 appears in the console.
  16. Click on the console and press the space key to close the console window.
Dev

E. Exiting and Restarting Projects

  • To close a project, use File->Close project before exiting CodeBlocks.
  • To restart a project, select (click on) the .cpb file for the project.
  • To ease setting up a new project, you can start with the start-sfml project
  • Make sure you unzip (extract) the project and then run it by double-clicking the file: start-sfml.cbp
  • The CBP (Code::Blocks Project) contains the information to start an exisiting project in Code::Blocks

F. More Information

  • Simple and Fast Multimedia Library: SFML Home Page
  • SFML and Code::Blocks (MinGW): SFML setup for use with Code::Blocks
  • Tutorials for SFML 2.4: More information on how to use SFML.

G. In Case of Trouble

Gl glut.h no such file or directory dev c yellow tickets official site
  1. If you see an error message like:

    verify that the file extension is .cpp and is not a .c file extension.

  2. If you see an error message like:

    make sure you have the correct SFML binary. (See Installing SFML step 3)

  3. An error message like:

    means you closed the console window before closing the SFML graphics window. To prevent the message, close the SFML graphics window before closing the console (terminal) window.

  4. An error message like:

    means that SFML could not correctly set up OpenGL because the window is larger than the screen or other reasons such as using remote desktop.

  5. An error message like:

    means that SFML could not locate the SFML/Graphics.hpp file because it is installed in the wrong folder. See Installing SFML steps 1 and 4.

  6. If the 'Build' option is grayed out, close any SFML and Terminal windows started by Code::Blocks.

For any other error, try reinstalling Code::Blocks, SFML or both, following the instructions carefully. Let the instructor know about your error and how you corrected the problem.

Gl Glut.h No Such File Or Directory Dev C Yellow Tickets 2020