Telegram Group & Telegram Channel
👨‍💻 Сегодня покажу вам удобный способ, как избавиться от болей с #include в больших C++ проектах.

Когда проект растёт, количество инклудов становится пугающим. Компиляция тормозит, зависимости запутаны, порядок подключения начинает влиять на поведение программы… Знакомо?

📌 Решение — Precompiled Headers (PCH).

Это не магия, а вполне рабочая практика. Всё просто:

1. Создаём файл pch.h, в котором собираем самые часто используемые инклюды:

// pch.h
#pragma once
#include <iostream>
#include <vector>
#include <map>
// и т.д.


2. Добавляем его в компиляцию с флагом:

g++ -x c++-header pch.h -o pch.h.gch


3. Теперь любой другой файл, который первым инклудит pch.h, компилируется быстрее.

⚡️ Бонус: современные сборочные системы, вроде CMake, умеют работать с PCH почти автоматически. Достаточно:

target_precompile_headers(my_target PRIVATE pch.h)


🧠 Маленький совет: следите, чтобы в pch.h не попадали редко используемые или изменяющиеся файлы — иначе получите обратный эффект.

Пользовались ли вы PCH в своих проектах? Какой прирост производительности заметили?

➡️ @cpp_geek



tg-me.com/cpp_geek/305
Create:
Last Update:

👨‍💻 Сегодня покажу вам удобный способ, как избавиться от болей с #include в больших C++ проектах.

Когда проект растёт, количество инклудов становится пугающим. Компиляция тормозит, зависимости запутаны, порядок подключения начинает влиять на поведение программы… Знакомо?

📌 Решение — Precompiled Headers (PCH).

Это не магия, а вполне рабочая практика. Всё просто:

1. Создаём файл pch.h, в котором собираем самые часто используемые инклюды:


// pch.h
#pragma once
#include <iostream>
#include <vector>
#include <map>
// и т.д.


2. Добавляем его в компиляцию с флагом:

g++ -x c++-header pch.h -o pch.h.gch


3. Теперь любой другой файл, который первым инклудит pch.h, компилируется быстрее.

⚡️ Бонус: современные сборочные системы, вроде CMake, умеют работать с PCH почти автоматически. Достаточно:

target_precompile_headers(my_target PRIVATE pch.h)


🧠 Маленький совет: следите, чтобы в pch.h не попадали редко используемые или изменяющиеся файлы — иначе получите обратный эффект.

Пользовались ли вы PCH в своих проектах? Какой прирост производительности заметили?

➡️ @cpp_geek

BY C++ geek


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/cpp_geek/305

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

For some time, Mr. Durov and a few dozen staffers had no fixed headquarters, but rather traveled the world, setting up shop in one city after another, he told the Journal in 2016. The company now has its operational base in Dubai, though it says it doesn’t keep servers there.Mr. Durov maintains a yearslong friendship from his VK days with actor and tech investor Jared Leto, with whom he shares an ascetic lifestyle that eschews meat and alcohol.

Look for Channels Online

You guessed it – the internet is your friend. A good place to start looking for Telegram channels is Reddit. This is one of the biggest sites on the internet, with millions of communities, including those from Telegram.Then, you can search one of the many dedicated websites for Telegram channel searching. One of them is telegram-group.com. This website has many categories and a really simple user interface. Another great site is telegram channels.me. It has even more channels than the previous one, and an even better user experience.These are just some of the many available websites. You can look them up online if you’re not satisfied with these two. All of these sites list only public channels. If you want to join a private channel, you’ll have to ask one of its members to invite you.

telegram from hk


Telegram C++ geek
FROM USA