Question

Every time I have to run icpc I have to type icpc -I/usr/include/x86_64-linux-gnu/c++/

How to include this is bashrc file so I have to just type icpc ?

Was it helpful?

Solution

Add the path to the C_INCLUDE variable.

export C_INCLUDE="$C_INCLUDE:/usr/include/x86_64-linux-gnu/c++/"

The preceding line should go into your .bash_profile file.

OTHER TIPS

You can use bash aliases:

alias icpc="icpc -I /usr/include/x86_64-linux-gnu/c++/"

as an alternative to an alias, you can define a function in your .bashrc: See Bash functions

icpc ()
{
   icpc -I/usr/include/x86_64-linux-gnu/c++/ 
}

The benefit of using a function is that you can have parameters (well, you can have parameters to an alias as well as long as the parameter is the last one on the line).

The function refers to passed arguments by position (as if they were positional parameters), that is, $1, $2, and so forth.

In order to call the function with arguments, change it to:

icpc ()
{
   icpc -I/usr/include/x86_64-linux-gnu/c++/ "$@"
}

In that way you can use

$ ipc some_argument

and have it executed as

icpc -I/usr/include/x86_64-linux-gnu/c++/ some_argument
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top