.CPP

Файл CPP

C++ Source Code File
Задать вопрос
БЫСТРЫЙ ОТВЕТ

A CPP file is plain-text C++ source code - the human-written instructions that a compiler turns into a runnable program. Open it in any code editor (VS Code, Notepad++, Xcode) to read or edit the code. To run it, compile it first with GCC, Clang, or MSVC: the file does nothing on its own.

Разработчик: Bjarne Stroustrup / Bell Labs (C++ language); standardized by ISO/IEC Категория: Файлы разработчика Открыть стандартное MIME: text/x-c++src
ОТКРЫВАЕТСЯ НА Windows macOS Linux
Связанные: .DO · .MD · .HEX · .XSD

На этой странице

Проиндексировано расширений: 19k+
Последняя проверка: Sep 7, 2026

Не знаете, что это за файл?

Перетащите любой файл в наш идентификатор - мы прочитаем первые байты, чтобы определить формат.

Идентифицировать файл

Что такое формат файла CPP?

.cpp files contain source code written in C++, a general-purpose programming language created by Bjarne Stroustrup at Bell Labs in the early 1980s. The .cpp extension stands for "C plus plus" - alternative conventions such as .cc and .cxx denote the same kind of source file under different toolchain traditions.

Contents of .cpp files

Files with a .cpp extension can contain such elements as:

  • variable and type declarations,
  • function declarations and definitions,
  • class declarations and member-function implementations,
  • preprocessor directives (e.g. #include <iostream>, #define),
  • references to system libraries and .h or .hpp header files,
  • comments for better code legibility - these are omitted during compilation.

Is a .cpp file a program?

.cpp files contain program source code written in C++, but in order to run such applications the source code must be compiled. A compiler - such as g++, clang++, or MSVC - takes the source code and translates it into machine code the computer can execute directly. Only the compiled output can be called a program; the .cpp file itself is just text. A project typically compiles multiple .cpp files and links them together to produce a final executable.

Can I open a .cpp file?

.cpp files are nothing more than plain text files and can be edited using any text editor. However, editing them requires knowledge of C++ syntax to avoid errors that may prevent compilation or cause the program to run incorrectly. For this reason, editing .cpp files is best done using dedicated tools that offer helpful features such as:

  • automated line numbering,
  • syntax highlighting,
  • code completion and hints,
  • syntax error notifications (missing closing brackets, semicolons, etc.),
  • integrated build and debugger support.

Popular environments include Microsoft Visual Studio, VS Code, and Apple Xcode. The .cpp file itself carries no embedded version information - the target C++ standard (from C++98 through C++23) is chosen at compile time via compiler flags.

Безопасность и защита

РИСК: LOW

A .cpp file is plain text and cannot run on its own, so opening one in an editor is safe. The risk appears only when you COMPILE and RUN unknown C++ code: source from an untrusted origin can do anything a program can once built (delete files, network access, install malware), and C++'s low-level access makes malicious or buggy code easy to hide. Read code before compiling it, build untrusted code in a sandbox/VM, and never run a compiled binary you don't trust. The file extension itself carries no exploit - the danger is in what the code does after compilation.

Детали формата

в двух словах
ПОЛНОЕ НАЗВАНИЕC++ Source Code Fileтакже известен как C plus plus source file, C++ implementation file
РАЗРАБОТЧИКBjarne Stroustrup / Bell Labs (C++ language); standardized by ISO/IECс C++ language created 1979-1985 (Bjarne Stroustrup, Bell Labs); first ISO standard C++98 (1998)
MIME-ТИПtext/x-c++src
ТИПPlain-text programming source code (C++ language)
СТАНДАРТОткрытый · без роялти
СВЯЗАННЫЕ.do.md.hex.xsd
Это расширение также используется в…
  • C++ source (alternate extensions) - The same C++ source role is also carried by .cc, .cxx, .c++ and (uppercase) .C; .cpp is the dominant Windows/cross-platform convention.

Программы, открывающие файлы CPP

Windows5 apps
Microsoft Visual Studio Freemium Open or add the .cpp to a C++ project and press Build/Run; the free Community edition includes the MSVC compiler.
Code::Blocks Открытый код Free cross-platform C++ IDE bundling MinGW; open the .cpp and press Build & Run.
Notepad Открытый код Open the .cpp to read/edit with C++ syntax highlighting (viewing/editing only - no compiler).
Visual Studio Code Бесплатно Open the .cpp for syntax-highlighted editing; add the C/C++ extension + a compiler (MSVC or MinGW g++) to build and debug.
MinGW-w64 / GCC (g++) Открытый код Command line: 'g++ hello.cpp -o hello.exe' then run hello.exe. The standard free Windows C++ compiler.
macOS2 apps
Apple Xcode (Apple Clang) Бесплатно Open in Xcode, or use the bundled clang++ from Terminal: 'clang++ hello.cpp -o hello && ./hello'.
Visual Studio Code Бесплатно Open the .cpp for syntax-highlighted editing; add the C/C++ extension + a compiler (MSVC or MinGW g++) to build and debug.
Linux3 apps
GCC / g++ (GNU Compiler Collection) Открытый код Compile from a terminal: 'g++ hello.cpp -o hello && ./hello'. Pre-installed or one package away on every distro.
GNU Emacs / Vim Открытый код Open the .cpp in the terminal editor to read/edit with C++ highlighting; pair with g++/make to build.
Visual Studio Code Бесплатно Open the .cpp for syntax-highlighted editing; add the C/C++ extension + a compiler (MSVC or MinGW g++) to build and debug.

Технические подробности

глубокая спецификация
MIME typetext/x-c++src (also accepted: text/x-c++ and text/plain)
File encodingPlain text - ASCII or UTF-8; a UTF-8 BOM (EF BB BF) at offset 0 is accepted but not required
File signature / magic bytesNone - identified by content: typically opens with // or /* */ comments, #include directives, or class/function definitions
File structurePreprocessor directives (#include, #define, #if), using/namespace declarations, class and function definitions, and the main() entry point
Compilation requiredYes - must be compiled by g++, clang++, or MSVC; the .cpp file is human-readable source text, not an executable
Target language standardsC++98, C++03, C++11, C++14, C++17, C++20, C++23; the standard is selected via a compiler flag (e.g., -std=c++17) and is not stored inside the file
Preprocessor stageBefore compilation, the C preprocessor expands #include directives, #define macros, and conditional-compilation blocks (#if / #endif)
Companion file types.h and .hpp (header declarations), .cc and .cxx (alternative C++ source extensions), .o / .obj (compiled object file output)
Compilation outputAn object file (.o on Linux/macOS, .obj on Windows) that the linker combines with other objects into an executable or shared library
Typical file sizeA few KB to tens of KB per source file; machine-generated or heavily templated files may exceed 1 MB
Unicode / character supportString literals and identifiers support Unicode (UTF-8) from C++11 onward; u8, u, and U string prefix literals allow explicit encoding control
Line endingsPlatform-independent - LF (Unix/macOS), CRLF (Windows), and CR are all accepted by major compilers
Associated operating systemsWindows, macOS, Linux - and any platform with a conforming C++ compiler toolchain
Standards bodyISO/IEC JTC1/SC22/WG21 (the C++ Standards Committee); standards are published as ISO/IEC 14882 revisions on roughly a 3-year cycle
File naming conventionTypically matches the class or module it implements - e.g., MyClass.cpp paired with MyClass.h or MyClass.hpp
Extension name meaningThe letters "pp" stand for "plus plus"; identical C++ source content may alternatively use .cc or .cxx by toolchain convention
ВыпущенC++ language created 1979-1985 (Bjarne Stroustrup, Bell Labs); first ISO standard C++98 (1998)
Последняя версияISO/IEC 14882:2024 (C++23); C++26 in progress
Открыть стандартноеДа · без роялти
Спецификацияisocpp.org

Конвертации CPP

Вопросы и ответы сообщества

спрошено пользователями
Задать быстрый вопрос
Получите помощь от людей, работающих с файлами CPP. Будьте конкретны - укажите вашу систему и версию ПО.
Аккаунт не нужен · ответы обычно в течение дня

Вопросов пока нет - станьте первым, кто спросит о файлах CPP.

Часто задаваемые вопросы

How do I open a .cpp file?
To read or edit it, open it in any text editor - Notepad++, VS Code, Vim or Xcode give C++ syntax highlighting. It's just text, so even Notepad works for a quick look.
How do I compile and run a .cpp file?
Install a C++ compiler and run it on the file. On Windows: 'g++ hello.cpp -o hello.exe' (MinGW) then run hello.exe, or build in Visual Studio. On macOS/Linux: 'g++ hello.cpp -o hello && ./hello'.
How do I turn a .cpp file into an .exe?
You compile it, not convert it. With GCC: 'g++ program.cpp -o program.exe'. In Visual Studio, add the .cpp to a project and press Build - the .exe is the compiler's output.
What's the difference between a .cpp and a .h file?
A .cpp file holds the implementation (the actual code); a .h/.hpp header holds declarations (prototypes, class/type definitions, macros) shared across .cpp files via #include. You compile .cpp files, not headers.
What is the difference between .cpp, .cc and .cxx?
All three are C++ source files - compilers treat them identically. .cpp is the common Windows/cross-platform choice; .cc and .cxx are conventions favoured by some Unix and Google-style projects. The extension is a style choice.
Is .cpp the same as .c?
No. .c is C source; .cpp is C++ source. Most C compiles as C++, but C++ adds classes, templates and namespaces that a C compiler can't handle. Compilers pick the language from the extension.

Ссылки

1GCC - GNU Compiler Collection (official)gcc.gnu.org
2ISO C++ - The C++ standard (isocpp.org)isocpp.org

Узнать больше

по всей базе данных

Популярные расширения на этой неделе

1.AQQAQQ Instant Messenger File
2.CRDOWNLOADChrome Partial Download File
3.DATProgram Data File (generic)
4.PARTPartial Download File
5.RPMSGRestricted Permission Message
6.EXEWindows Executable (Portable Executable)
7.BINCD/DVD Disc Image (BIN/CUE)
8.DLLDynamic Link Library
9.JPGJPEG Image
10.M4AMPEG-4 Audio File

Похожие расширения

.DOStata Do-File
.MDMarkdown Document
.HEXIntel HEX File
.XSDXML Schema Definition
.MAPSource Map (JavaScript / CSS)
.CONFIGConfiguration File

Бесплатные инструменты для файлов

Идентификатор файлов и конвертер изображений в браузере - все работает на вашем устройстве.

Открыть инструменты

Обзор расширений файлов A-Z