开发者

Is there a way to make a c++ compiler flag as default

开发者 https://www.devze.com 2023-02-07 07:19 出处:网络
Just like we specify input flags in the settings of the project in Xcode Can I make few flags like -O3 or 开发者_JAVA技巧-fopenmp as default flags in command line when I use Terminal.

Just like we specify input flags in the settings of the project in Xcode

Can I make few flags like -O3 or 开发者_JAVA技巧-fopenmp as default flags in command line when I use Terminal.

So that I dont have to type them everytime I compile some c++ fies. Is there a file in the installed gcc or C++ that I can edit to make them default. Please let me know thanks


For situations like this you'd probably use a makefile if it's project specific (or other similar automated build management like scons or cmake).

If you want it always on the terminal, you can alias your command to always specify those options, i.e.

alias g++='g++ -O3 -fopenmp'

Note that you said 'terminal' so I assume this is a type of *nix. If that is the case you can also set this into your terminal profile, like ~/.bashrc if you use bash, or ~/.zshrc if you use zsh, etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消