Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am compiling quite big project from source. The compilation always ends with: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

I have already compiled this project one year ago. So I know a solution to this. Actualy I found more solutions:

  1. Adding a typecast to appropriate line of cpp code (It went to endless number of changes in each file. So I found next solution.)
  2. Modifying a makefile to compile that file with -fpermissive option. (I had to modify a lot of lines in each makefile. So I find even better solution.)
  3. "g++" or "gcc" was stored in a variable so I added -fpermissive to these variables.

This is the best solution I have. It is sufficient to add this option to each makefile once. Unfortunately this software has big number of subdirectories. So I need to modify more than 100 makefiles. It took me whole day one year ago.

Is there a way how to do this faster.

What about this? alias gcc='gcc -fpermissive' I am not familiar with aliases. But it should be easy to try this. Is the syntax correct? And is this one correct? alias g++='g++ -fpermissive' ? And do I need to export the alias somehow? Will the make program respect the alias?

Should I maybe change ./configure script? Or the ./configure.in? Or other file?

share|improve this question
add comment

1 Answer

Aliases are most easily set up by placing the relevant line in your ~/.bashrc file. When you issue a command, BASH will search your $PATH for the first instance of an executable of that name. Aliases in your ~/.bashrc file will always be found first so if you have an alias with the same name as an actual command (e.g. gcc) the alias will be executed.

So, in your case, add these lines to your ~/.bashrc (yes the syntax is correct):

alias gcc='gcc -fpermissive'
alias g++='g++ -fpermissive'

Alternatively, you can make different aliases so that you can choose whether or not you want the -fpermissive flag:

alias gcc_per='gcc -fpermissive'
alias g++_per='g++ -fpermissive'

That way, you can use gcc to run /usr/bin/gcc or gcc_per to run /usr/bin/gcc -fpermissive according to your needs. Obviously, you can set the alias to whatever you want, the name is up to you.

Once you have added the relevant lines to your ~/.bashrc, either source it (source ~/.bashrc) or just open a new terminal and you new aliases are set up and ready to go.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.