Undefined reference to strrev | Error Code in C
You may come across this error “undefined reference to strrev” while coding in C. The function ‘strrev’ can be other string function. You may surprise the code that you have written is working fine on one of the system, while not on other systems.
Error message “Undefined reference to strrev”:
C:\Users\ANIRUD~1\AppData\Local\Temp\ccjLOzro.o(.text+0xbb):<c_prog_file_name>.c: undefined reference to strrev
The functions strrev() available in the string.h library. Functions strrev() including some other string function such as like strupr, strlwr, strrev, which are only available in ANSI C (Turbo C/C++) and are not available in standard C-GCC compiler.
If you are running this program on GCC compiler, it will throw error message as “<prog_name>.c: undefined reference to strrev”. In this case, you have to write the complete function that works same as an inbuilt function.
Ex. You can check out the code here to implement strstr() function.
You can chek out the C program for palindrome . Run it on the multiple compilers. This program gets compiled and run successfully on ANSI C compiler. Whereas tt throws an error if you are running it on GCC compiler.