現在WIN32 コンソールアプリケーションの開発中です。
ソースコード中に何か記入して、特定の条件(マクロが定義されている)の時だけ出力ファイル(exeファイル)の名称を変更したいのですが、可能であればそのやり方を教えて下さい。
-------------------------------------------
#ifdef MODE_HOGE
#pragma output("a2.exe")
#endif
-------------------------------------------
こんな感じで、二行目をどうやって書けばいいかが知りたいです。
海外 Q&A サイト(Stack Overflow)ですが、同様の質問がありました。
(Visual Studio 2008 が手元に無くて確認できないですが、以下の手順で設定できるかと思います。)
■ c++ - Specify the name of compiled binary (*.exe) within source code in Visual Studio 2008 - Stack Overflow
http://stackoverflow.com/questions/1574861/specify-the-name-of-compiled-binary-exe-within-source-code-in-visual-studio
<設定方法>
1. プロジェクトファイルの設定を変更 [プロジェクト] - [プロパティ] - [リンカ] - [全般] - [出力ファイル] の [$(OutDir)\$(ProjectName).exe] をブランクに変更。 2. ソースコードを修正 #pragma comment(linker, "/out:a2.exe")
<例>
#ifdef MODE_HOGE #pragma comment(linker, "/out:a2.exe") #endif
海外 Q&A サイト(Stack Overflow)ですが、同様の質問がありました。
(Visual Studio 2008 が手元に無くて確認できないですが、以下の手順で設定できるかと思います。)
■ c++ - Specify the name of compiled binary (*.exe) within source code in Visual Studio 2008 - Stack Overflow
http://stackoverflow.com/questions/1574861/specify-the-name-of-compiled-binary-exe-within-source-code-in-visual-studio
<設定方法>
1. プロジェクトファイルの設定を変更 [プロジェクト] - [プロパティ] - [リンカ] - [全般] - [出力ファイル] の [$(OutDir)\$(ProjectName).exe] をブランクに変更。 2. ソースコードを修正 #pragma comment(linker, "/out:a2.exe")
<例>
#ifdef MODE_HOGE #pragma comment(linker, "/out:a2.exe") #endif
回答ありがとうございます。
上記の方法で設定できました。
回答ありがとうございます。
2013/08/12 10:57:06上記の方法で設定できました。