I have C code which is compiled in 2.2 kernel using Makefile. Now I am compiling the same code in 2.6 RHEL kernel using Make file. It throws an error "previous implicit declaration of 'function name' was here.
If I declare its prototype at the begining of the file I know it works. But I have many C files and many functions.
Is there any settings in Make file flag settings which will throw these errors as warnings
Porting C code from 2.2 kernel to 2.6 RHEL kernel?
Your issue has nothing to do with the kernel you are on. You would get the same issue on 2.2, 2.6, on Windows, Macs, etc.
%26gt; It throws an error "previous implicit declaration of 'function name' was here.
Either prototype your functions (declare them before using them), or move the definition above where you use it.
%26gt; If I declare its prototype at the begining of the file I know it works.
Sure. You should be declaring your functions before using them. So I'm guessing you don't do that?
%26gt; But I have many C files and many functions.
Is this code that you wrote? You may want to pick up a good book on C (google C FAQ. Somewhere there they have recommendations on books).
%26gt; Is there any settings in Make file flag settings which will throw these errors as warnings
No. And you don't seem to understand the purpose of errors/warnings. Compiling isn't a game of "try to get away with 0 errors". You want correct code. Errors means you made a syntactical error that *definitely* prevents your code from being compiled. You can't wish that away. Your code is broken. You can't compile broken code.
Warnings aren't something you ignore either. Why do you think we recommend compiling with -Wall? It's because warnings are important. Warnings are a diagnostic message. Your code compiles because it can be compiled. But that doesn't mean the code is correct. Always pay attention to warnings.
Fix your code. Learn C if you don't know how.
Reply:There are none, fix all the warnings.
bloom
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment