#include <bits/stdc++.h> int main() { std::cout << "Hello, world!" << std::endl; }</bits/stdc++.h>
OpenSiv3Dの入手 https://siv3d.github.io/#getting-started こちらからmacOS版のOpenSiv3Dをダウンロードしてください。 CLionで開く CLionでダウンロードしたフォルダを開きます
ファイルを読み込む際など、ファイルのパスを絶対パスで指定した場合はうまくいくのに、相対パスの時はエラーになってしまう。 そんな時の対処法です。 Edit Configuration -> Working Directory を設定 参考 パス変数 - ヘルプ | CLion
#include <stdio.h> #include <stdlib.h> #include <GL/glew.h> #include <GLFW/glfw3.h> GLFWwindow* window; // グローバル変数を定義 #include <glm/glm.hpp> using namespace glm; int main( void ) { // GLFWの初期化 if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); getchar(); return -</glm/glm.hpp></glfw/glfw3.h></gl/glew.h></stdlib.h></stdio.h>…
コマンドで以下のように打ち込むことにより、実行の結果をファイルに書き込むことができる。 ./program > hello.txt また、入力を受け取るような実行ファイルの場合、 ./foo < boo.txt のようにすることにより、boo.txtから入力を受け取ることができる。 ま…
標準出力 // helloと改行を出力するプログラム int main() { std::cout << "hello"s; } int main() { std::cout << "aaa"s << "bbb"s << "ccc"s; } 出力結果はaaabbbccc 文字列の結合 int main() { std::cout << "hello"s + "world"s; } 出力結果はhelloworl…
Makefileという名前のファイルを作成 Makefile内に次のように記述する program : 事前用件 [TAB] レシピ 例えば program : source [TAB] cat source > program 事前用件の数を増やすこともできる source : source01 source02 source03 cat source01 source02…
このall.hを使う時は、 #include "all.h" と書くか、 コンパイル時に g++ -include all.h -o <出力するファイル名> main.cpp のようにする。 事前コンパイル ヘッダーファイルを事前にコンパイルするには g++ -std=c++17 -Wall --pedantic-errors -x c++-hea…
方法 g++ <その他のオプション> -o <実行ファイル名> <ソースファイル名>.cpp ソースファイルを複数指定することもできる。 g++ -o abc a.cpp b.cpp c.cpp 主なオプション -std= ... C++のバージョンを指定する(例. -std=c++17 ) -Wall ... 警告メッセージを…