Predefined Header for Global Includes

I'm currently abstracting OpenGL in C ++, and I'm just curious to know if any particular practice is my work pure and efficient or the exact opposite. I have a header file that is included in almost every header file for abstraction called "pd.h", and in this file I include everything I need for my program:

#pragma once
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>

Is this a very unclean and inefficient way to structure my code? Because this is how I learned to do something and for some reason looked at him now, he looks absurd, and if this is not good practice, can anyone explain why I should not do this?

+4
source share
1 answer

, , , , , .cpp .o .

  • , pd.h , . , . , , .

  • .cpp, , . ( VS), ISO ++. , , , .

    , . .

, . .cpp? . , .

. , , .

- , , :

  • forward (, include )

iosfwd, iostream, , operator<< . std::ostream &, .

+5

Source: https://habr.com/ru/post/1695569/


All Articles