ホーム » gcc » g++ インクルードパスの設定

2019年9月
1234567
891011121314
15161718192021
22232425262728
2930  

カテゴリー

アーカイブ

ブログ統計情報

  • 80,461 アクセス



g++ インクルードパスの設定

先日,Windows 環境に mount することで C++ の共通のコードを参照できる様になった.
今度は,これらを使用してコンパイルできるようにするための設定.
g++ file.cpp -I/mnt/_.src/__CPR_ などと指定すれば可能だが,これらのパスを 環境変数 に登録.

[Iwao@fedora first]$ g++ T_P_ini.cpp -I/mnt/_.src/__CPR_ -I/mnt/_.src/__Iwao -I/mnt/_.src/__Mlt_ -I/mnt/_.src/_gcc -Wall
In file included from /mnt/_.src/__Iwao/delff_e.hxx:14,
                 from /mnt/_.src/__CPR_/filefnc.hxx:13,
                 from /mnt/_.src/__CPR_/i_Trace.hxx:16,
                 from T_P_ini.cpp:5:
/mnt/_.src/__Iwao/enumfile.hxx:33:56: 備考: #pragma message: EnumFile.hxx MessageBar  No Support
   33 | #pragma  message ("EnumFile.hxx MessageBar  No Support")
      |                                                        ^
[Iwao@fedora first]$ ./a.out 
Iwao
Iwao
[Iwao@fedora first]$ 

g++ main.cpp -I(include path)

[Iwao@fedora first]$ export CPATH=/mnt/_.src/__CPR_:/mnt/_.src/__Iwao:/mnt/_.src/__Mlt_:/mnt/_.src/_gcc
[Iwao@fedora first]$ g++ T_P_ini.cpp -Wall
In file included from /mnt/_.src/__Iwao/delff_e.hxx:14,
                 from /mnt/_.src/__CPR_/filefnc.hxx:13,
                 from /mnt/_.src/__CPR_/i_Trace.hxx:16,
                 from T_P_ini.cpp:5:
/mnt/_.src/__Iwao/enumfile.hxx:33:56: 備考: #pragma message: EnumFile.hxx MessageBar  No Support
   33 | #pragma  message ("EnumFile.hxx MessageBar  No Support")
      |                                                        ^
[Iwao@fedora first]$ 

export CPATH による環境変数の指定


export の部分を sh ファイルに

[Iwao@fedora first]$ cat set_z_inc.sh 
#!/bin/bash
export	CPATH=/mnt/_.src/__CPR_
export	CPATH=$CPATH:/mnt/_.src/__Iwao
export	CPATH=$CPATH:/mnt/_.src/__Mlt_
export	CPATH=$CPATH:/mnt/_.src/_gcc
export	CPATH=$CPATH:/mnt/_.src/Test

[Iwao@fedora first]$ source ./set_z_inc.sh 
: コマンドが見つかりませんでした...
[Iwao@fedora first]$ 

登録内容を見てみると何かおかしい.

[Iwao@fedora first]$ export
declare -x BASH_ENV="/usr/share/Modules/init/bash"
declare -x COLORTERM="truecolor"
"/mnt/_.src/Testt_/mnt/_.src/__CPR_
declare -x DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"
...

原因は改行コード.CRLF になっていたので LF に.
スクリプトファイルの改行コードを LF に


本当はもっと良い方法があるとは思うが,まだそこまで理解できていない.
Fedora での source ....sh と g++
Ubuntu での source ....sh と g++
Raspberry Pi での source ....sh と g++
ここまでで何とか思ったことまでは可能.


5 年前に GLUT を調べた 時のコードを,最近のコードで動作するように少し編集.
Windows での GLUT を使用したもの 2014/08 \\DevS\...\VC_Test\GL_Pick
2014/08 の GLUT を使用したコードのビルドと実行


こちらは当時のコードそのまま.Pick07.cpp
5 年前のコードをそのままビルド Pick07

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

1件のコメント

  1. […] 以前コンパイルした a.out は動作した. この頃はまだ他社 NAS の購入前なので,DS116 と,仮想マシンの Linux 環境で作成したものと思う. 他のものを幾つか試したが,ほとんど動作しない. […]

コメントする

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

%d人のブロガーが「いいね」をつけました。