c++ compiling
c++ compiling
g++ -o hello.cpp hello
Re: c++ compiling
gcc hello.c
на выходе будет a.out исполняемая программа
на выходе будет a.out исполняемая программа
Последний раз редактировалось ya 22 авг 2023, 22:11, всего редактировалось 4 раза.
Re: c++ compiling
Код: Выделить всё
Usage: gcc [options] file...
Options:
-pass-exit-codes Exit with highest error code from a phase.
--help Display this information.
--target-help Display target specific command line options.
--help={common|optimizers|params|target|warnings|[^]{joined|separate|undocumented}}[,...].
Display specific types of command line options.
(Use '-v --help' to display command line options of sub-processes).
--version Display compiler version information.
-dumpspecs Display all of the built in spec strings.
-dumpversion Display the version of the compiler.
-dumpmachine Display the compiler's target processor.
-print-search-dirs Display the directories in the compiler's search path.
-print-libgcc-file-name Display the name of the compiler's companion library.
-print-file-name=<lib> Display the full path to library <lib>.
-print-prog-name=<prog> Display the full path to compiler component <prog>.
-print-multiarch Display the target's normalized GNU triplet, used as
a component in the library path.
-print-multi-directory Display the root directory for versions of libgcc.
-print-multi-lib Display the mapping between command line options and
multiple library search directories.
-print-multi-os-directory Display the relative path to OS libraries.
-print-sysroot Display the target libraries directory.
-print-sysroot-headers-suffix Display the sysroot suffix used to find headers.
-Wa,<options> Pass comma-separated <options> on to the assembler.
-Wp,<options> Pass comma-separated <options> on to the preprocessor.
-Wl,<options> Pass comma-separated <options> on to the linker.
-Xassembler <arg> Pass <arg> on to the assembler.
-Xpreprocessor <arg> Pass <arg> on to the preprocessor.
-Xlinker <arg> Pass <arg> on to the linker.
-save-temps Do not delete intermediate files.
-save-temps=<arg> Do not delete intermediate files.
-no-canonical-prefixes Do not canonicalize paths when building relative
prefixes to other gcc components.
-pipe Use pipes rather than intermediate files.
-time Time the execution of each subprocess.
-specs=<file> Override built-in specs with the contents of <file>.
-std=<standard> Assume that the input sources are for <standard>.
--sysroot=<directory> Use <directory> as the root directory for headers
and libraries.
-B <directory> Add <directory> to the compiler's search paths.
-v Display the programs invoked by the compiler.
-### Like -v but options quoted and commands not executed.
-E Preprocess only; do not compile, assemble or link.
-S Compile only; do not assemble or link.
-c Compile and assemble, but do not link.
-o <file> Place the output into <file>.
-pie Create a position independent executable.
-shared Create a shared library.
-x <language> Specify the language of the following input files.
Permissible languages include: c c++ assembler none
'none' means revert to the default behavior of
guessing the language based on the file's extension.
Options starting with -g, -f, -m, -O, -W, or --param are automatically
passed on to the various sub-processes invoked by gcc. In order to pass
other options on to these processes the -W<letter> options must be used.
For bug reporting instructions, please see:
<file:///usr/share/doc/gcc-6/README.Bugs>.
Re: c++ compiling
Код: Выделить всё
Usage: gcc [options] file...
Options:
-pass-exit-codes Выход из фазы с наибольшим кодом ошибки.
--help Вывод информации.
--target-help Отображение специфических для цели опций командной строки.
--help={common|optimizers|params|target|warnings|[^]{joined|separate|undocumented}}[,...].
Отображение определенных типов опций командной строки.
(Для отображения параметров командной строки подпроцессов используйте '-v --help').
--version Вывести информацию о версии компилятора.
-dumpspecs Вывести все встроенные строки спецификаций.
-dumpversion Вывести версию компилятора.
-dumpmachine Вывести целевой процессор компилятора.
-print-search-dirs Отображение каталогов в пути поиска компилятора.
-print-libgcc-file-name Отображение имени библиотеки-компаньона компилятора.
-print-file-name=<lib> Вывести полный путь к библиотеке <lib>.
-print-prog-name=<prog> Вывести полный путь к компоненту компилятора <prog>.
-print-multiarch Вывести нормализованный GNU-триплет целевой библиотеки, используемый в качестве
компонента в пути к библиотеке
-print-multi-directory Отображение корневого каталога для версий libgcc.
-print-multi-lib Отображение соответствия между опциями командной строки и
каталогами поиска нескольких библиотек.
-print-multi-os-directory Отображение относительного пути к библиотекам ОС.
-print-sysroot Отображение каталога целевых библиотек.
-print-sysroot-headers-suffix Вывести суффикс sysroot, используемый для поиска заголовков.
-Wa,<options> Передать ассемблеру разделенные запятыми <options>.
-Wp,<options> Передать разделенные запятыми <options> препроцессору.
-Wl,<options> Передать разделенные запятыми <options> компоновщику.
-Xassembler <arg> Передать <arg> ассемблеру.
-Xpreprocessor <arg> Передать <arg> препроцессору.
-Xlinker <arg> Передать <arg> компоновщику.
-save-temps Не удалять промежуточные файлы.
-save-temps=<arg> Не удалять промежуточные файлы.
-no-canonical-prefixes Не канонизировать пути при сборке относительных
префиксов к другим компонентам gcc.
-pipe Использовать трубы вместо промежуточных файлов.
-time Определять время выполнения каждого подпроцесса.
-specs=<file> Переопределять встроенные спецификации содержимым <file>
-std=<standard> Предполагать, что входные источники предназначены для <standard>.
--sysroot=<directory> Использовать <директорию> в качестве корневого каталога для заголовков и библиотек.
-B <directory> Добавить <директорию> в пути поиска компилятора.
-v Отображать программы, вызываемые компилятором.
-### Аналогично -v, но опции берутся в кавычки, а команды не выполняются.
-E Только предварительная обработка; не компилировать, не собирать и не компоновать.
-S Только компиляция; не собирать и не компоновать.
-c Компилировать и собирать, но не компоновать.
-o <file> Поместить вывод в <file>
-pie Создать позиционно-независимый исполняемый файл.
-shared Создать разделяемую библиотеку.
-x <language> Указать язык следующих входных файлов.
Допустимые языки: c c++ ассемблер none
'none' означает возврат к стандартному поведению
угадывать язык по расширению файла.
Опции, начинающиеся с -g, -f, -m, -O, -W или --param, автоматически передаются в различные подпроцессы.
передаются различным подпроцессам, вызываемым gcc. Для того чтобы передать
других опций этим процессам необходимо использовать опцию -W<буква>.
Инструкции по сообщению об ошибках см:
<file:///usr/share/doc/gcc-6/README.Bugs>.
Re: c++ compiling
1. Препроцессинг
*.h , makross
2. Компилятор
*.asm
3. Ассемблирование
*.o
4. Компановка (линковка)
*.h , makross
2. Компилятор
*.asm
3. Ассемблирование
*.o
4. Компановка (линковка)
Re: c++ compiling
Код: Выделить всё
Usage: g++ [options] file...
Options:
-pass-exit-codes Exit with highest error code from a phase.
--help Display this information.
--target-help Display target specific command line options.
--help={common|optimizers|params|target|warnings|[^]{joined|separate|undocumented}}[,...].
Display specific types of command line options.
(Use '-v --help' to display command line options of sub-processes).
--version Display compiler version information.
-dumpspecs Display all of the built in spec strings.
-dumpversion Display the version of the compiler.
-dumpmachine Display the compiler's target processor.
-print-search-dirs Display the directories in the compiler's search path.
-print-libgcc-file-name Display the name of the compiler's companion library.
-print-file-name=<lib> Display the full path to library <lib>.
-print-prog-name=<prog> Display the full path to compiler component <prog>.
-print-multiarch Display the target's normalized GNU triplet, used as
a component in the library path.
-print-multi-directory Display the root directory for versions of libgcc.
-print-multi-lib Display the mapping between command line options and
multiple library search directories.
-print-multi-os-directory Display the relative path to OS libraries.
-print-sysroot Display the target libraries directory.
-print-sysroot-headers-suffix Display the sysroot suffix used to find headers.
-Wa,<options> Pass comma-separated <options> on to the assembler.
-Wp,<options> Pass comma-separated <options> on to the preprocessor.
-Wl,<options> Pass comma-separated <options> on to the linker.
-Xassembler <arg> Pass <arg> on to the assembler.
-Xpreprocessor <arg> Pass <arg> on to the preprocessor.
-Xlinker <arg> Pass <arg> on to the linker.
-save-temps Do not delete intermediate files.
-save-temps=<arg> Do not delete intermediate files.
-no-canonical-prefixes Do not canonicalize paths when building relative
prefixes to other gcc components.
-pipe Use pipes rather than intermediate files.
-time Time the execution of each subprocess.
-specs=<file> Override built-in specs with the contents of <file>.
-std=<standard> Assume that the input sources are for <standard>.
--sysroot=<directory> Use <directory> as the root directory for headers
and libraries.
-B <directory> Add <directory> to the compiler's search paths.
-v Display the programs invoked by the compiler.
-### Like -v but options quoted and commands not executed.
-E Preprocess only; do not compile, assemble or link.
-S Compile only; do not assemble or link.
-c Compile and assemble, but do not link.
-o <file> Place the output into <file>.
-pie Create a position independent executable.
-shared Create a shared library.
-x <language> Specify the language of the following input files.
Permissible languages include: c c++ assembler none
'none' means revert to the default behavior of
guessing the language based on the file's extension.
Options starting with -g, -f, -m, -O, -W, or --param are automatically
passed on to the various sub-processes invoked by g++. In order to pass
other options on to these processes the -W<letter> options must be used.
For bug reporting instructions, please see:
<file:///usr/share/doc/gcc-6/README.Bugs>.
Re: c++ compiling
http://www.equation.com/servlet/equation.cmd?fa=fortran
Fortran, C and C++ for Windows
This web page provides GNU Fortran, C and C++ for Windows for download. Equation Solution build the compiler.
DOWNLOAD: RELEASES
Fortran, C and C++ for Windows
This web page provides GNU Fortran, C and C++ for Windows for download. Equation Solution build the compiler.
DOWNLOAD: RELEASES
Re: c++ compiling win7
Код: Выделить всё
#include <iostream>
#include <string>
#include <cstdio>
#include <memory>
#include <iomanip>
#include <sstream>
#include <sys/stat.h>
bool file_exists(const std::string& filepath) {
struct stat buffer;
return (stat(filepath.c_str(), &buffer) == 0);
}
double get_video_duration(const std::string& filepath) {
char buffer[128];
std::string command = "ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 -i \"" + filepath + "\"";
std::shared_ptr<FILE> pipe(popen(command.c_str(), "r"), pclose);
if (!pipe) throw std::runtime_error("popen() failed!");
double video_duration = 0.0;
if (fgets(buffer, 128, pipe.get()) != nullptr) {
video_duration = std::stod(buffer);
}
return video_duration;
}
std::string format_duration(double duration) {
int hours = static_cast<int>(duration / 3600);
duration -= hours * 3600;
int minutes = static_cast<int>(duration / 60);
duration -= minutes * 60;
int seconds = static_cast<int>(duration);
std::ostringstream formatted_duration;
formatted_duration << std::setfill('0') << std::setw(2) << hours << "\\:"
<< std::setw(2) << minutes << "\\:"
<< std::setw(2) << seconds;
return formatted_duration.str();
}
void play_video(const std::string &filepath) {
double video_duration = get_video_duration(filepath);
std::string formatted_duration = format_duration(video_duration);
std::string command = "ffplay -i \"" + filepath + "\""
" -vf \"scale='min(1280,iw)':min'(850,ih)':force_original_aspect_ratio=decrease,drawtext=text='%{pts\\:gmtime\\:0\\:%H\\\\\\:%M\\\\\\:%S}/" + formatted_duration +
"':box=1:fontcolor=black:shadowcolor=white:shadowx=1:shadowy=1:fontsize=16:x=(w-tw)-(lh):y=h-(2*lh)\""
" -autoexit -stats ";
system(command.c_str());
}
int main(int argc, char* argv[]) {
if (argc != 2) {
std::cerr << "Usage: " << argv[0] << " <video-file>" << std::endl;
return 1;
}
std::string filepath = argv[1];
if (!file_exists(filepath)) {
std::cerr << "Error: The provided file does not exist." << std::endl;
return 1;
}
try {
play_video(filepath);
} catch (const std::runtime_error &e) {
std::cerr << "Error: " << e.what() << std::endl;
return 1;
}
return 0;
}
Re: c++ compiling
Компилятор
https://winlibs.com
apt install clang g++
Визуальный редактор
https://code.visualstudio.com
редактор c++
https://github.com/Embarcadero/Dev-Cpp/releases
Онлайн-комплятор:
https://wandbox.org
https://coliru.stacked-crooked.com
https://godbolt.org
https://winlibs.com
apt install clang g++
Визуальный редактор
https://code.visualstudio.com
редактор c++
https://github.com/Embarcadero/Dev-Cpp/releases
Онлайн-комплятор:
https://wandbox.org
https://coliru.stacked-crooked.com
https://godbolt.org