Thread: error: dereferencing pointer to incomplete type

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    20

    Thumbs down error: dereferencing pointer to incomplete type

    how you will deal this problem and what should be the correct syntax............

    Code:
    Convert time from pcap pkthdr format (double longs) to 
    1/10,000 seconds since midnight
    */
    int get_pkttime (struct pcap_pkthdr *pkthdr)
     {
    	struct tm *time;
    	time = localtime(&pkthdr->ts.tv_sec);
    	return  
    		(int)
    		pkthdr->ts.tv_usec/100 +  /*  Convert microseconds */
    		M0SEC *(time->tm_sec + 60*(time->tm_min + 60*time->tm_hour));
    }
    error: dereferencing pointer to incomplete type

    please give me feedback.

  2. #2
    Registered User
    Join Date
    Sep 2007
    Posts
    1,012
    Code:
    #include <time.h>

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    You cannot use types that has not been declared or defined. The compiler must see an appropriate declaration or definition before it can use said type.
    This error is usually because you forget to include a proper header file.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting the matrix question..
    By transgalactic2 in forum C Programming
    Replies: 47
    Last Post: 12-22-2008, 03:17 PM
  2. Replies: 0
    Last Post: 03-20-2008, 07:59 AM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  4. towers of hanoi problem
    By aik_21 in forum C Programming
    Replies: 1
    Last Post: 10-02-2004, 01:34 PM
  5. Glib and file manipulation
    By unixOZ in forum Linux Programming
    Replies: 1
    Last Post: 03-22-2004, 09:39 PM