Вопрос о файлах заголовков и функциях в отдельных файлах на C++ [дубликат]C++

Программы на C++. Форум разработчиков
Ответить Пред. темаСлед. тема
Гость
 Вопрос о файлах заголовков и функциях в отдельных файлах на C++ [дубликат]

Сообщение Гость »


У меня вопрос по поводу заголовочных файлов в C++:
допустим, у нас есть строка

Код: Выделить всё

#include 
. I have read that this header file contains the function declarations for the math functions. However, why is it that when we compile a file with some math functions with inclusion of the header , it doesn't have any error? If the header file doesn't contain function definitions, then shouldn't we need to compile it together with the files for the function definitions in order for it to work?
On the other hand, when we have files on our own that have separate function definition and declaration, we need to compile the

Код: Выделить всё

main.cpp
files with the function definition file in order for it to compile.
Why is it that with header files like and , we don't need to do this?


Источник: https://stackoverflow.com/questions/781 ... files-in-c
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «C++»