It has been a while since I messed with C code.
I am getting the following error when compiling C code under Ubuntu using gcc.
The command I am using to compile code is (if these errors are because of compiler I am using, please let me know how to make that go away):
gcc -o runnable mycode.C
error: invalid conversion from ‘void*’ to ‘char**’
Line 39 is :
sequence=malloc(sizeof(char *)*seqNum);
sequence is declared as:
char **sequence;
seqNum is declared as:
int seqNum
Added: The fasted solution to Arron’s actual problem is provided by sgm in a comment. The text below is all accurate, and hopefully helpful, but a second rate solution to the problem at hand.
Your compiler is being very stiffnecked about pointer casts (are you using a c++ compiler?), adding an explicit cast like
should make the error go away. Alternately you might be able to convince the compiler to go easy on you with some kind of option like
which might be preferable if this is in some third party code that you don’t really want to hack. Read your compiler documentation to find the option you want. Since all the
gccs I have on hand (versions 4.0 and 4.2) are happy with that code, I’m not in a good place to offer advice on switches to turn this behavior off.