Thread: implicit declaration

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    22

    implicit declaration

    I have defined two functions:
    extract_ip_patterns and extract_op_patterns.
    They are almost the same and used in the same main program. But there is a warning message about extract_op_patterns:

    implicit declaration of function 'extract_op_patterns'

    whereas there is no such warning message about extract_ip_patterns. And I found that if I use them seperately, there is no warning message. Can anyone help me to solve this problem?

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    int main( void )
    {
        return foo( );
    }
    
    int foo( void ) { return 0; }
    Can you spot the problem in the above code? If not, that's your problem. If so, that's your answer.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    22
    I'm sorry that I can't understand. Can you explain it in more details?

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    32
    Quzah is showing you that you need to declare the function before you use it... I guess you're trying to use 'extract_op_patterns' before even you declared it.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    22
    I think I have declared it. As I mentioned, there is a similar function called 'extract_ip_patterns' which is used in the same program.
    But, there is no problem on using this function. And, I have used the same way to use 'extract_op_patterns'.
    However, it doesn't work. Maybe the problem is easier to be found with my code posted.

  6. #6
    char main() RoshanX's Avatar
    Join Date
    Mar 2003
    Posts
    68
    I think you have not included the function body of the function,
    extract_ip_patterns. If this is in another source file, you have to compile it like this. If you are using GCC
    Code:
           gcc extract_ip_patterns.c svm-train3.c
    extrace_ip_patterns.c is the source file containing the funtion body of the extract_ip_patterns.
    If you have already done this check the spelling.

    This code compiles(even without a warning) and works fine. I used GCC.
    Code:
    int main( void )
    {
        return foo( );
    }
    
    int foo( void ) { return 0; }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  2. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM