Reputation: 305
I am compiling a function and getting warning:
**/tmp/ccPFK7nG.o: warning gets is dangerous and should not be used.**
Now I know why the warning is coming, the part that I am not aware is the location from where the warning is coming keeps changing. Every time I compile the code the location is /tmp/some_file.o Is it like gcc makes the temporary object file in /tmp directory and when the executable is made it removes it from there?
Upvotes: 1
Views: 144
Reputation: 91017
If compiling and linking at the same time, such as
gcc a.c b.c c.c -o wholeprogram
each mentioned C module gets compiled into a temporary object file, then all object files are linked together to get the final executable.
The names of these temporary obejct files are created dynamically and on the fly and, thus, change on every invocation.
Upvotes: 1
Reputation: 7691
Every time I compile the code the location is /tmp/some_file.o Is it like gcc makes the temporary object file in /tmp directory and when the executable is made it removes it from there?
What you see is a side effect of the -flto
option in gcc, that enables link time optimization. The compiled source for this second pass is indeed a temporary, containing precompiled data from object files.
To see the real culprit, you may need to remove this option and recompile, although the warning should appear with the correct file location in the first pass.
Upvotes: 2
Reputation: 9474
Suggest to remove the usage of gets()
. Since ISO C11
removes the specification of gets()
from the C language.
http://linux.die.net/man/3/gets
Read BUGS and Conforming to section.
Upvotes: 1