error: dereferencing pointer to incomplete type

This is a discussion on error: dereferencing pointer to incomplete type within the C Programming forums, part of the General Programming Boards category; how you will deal this problem and what should be the correct syntax............ Code: Convert time from pcap pkthdr format ...

  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
    cas
    cas is offline
    Registered User
    Join Date
    Sep 2007
    Posts
    993
    Code:
    #include <time.h>

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,900
    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, 08:59 AM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-30-2005, 12:21 AM
  4. towers of hanoi problem
    By aik_21 in forum C Programming
    Replies: 1
    Last Post: 10-02-2004, 02:34 PM
  5. Glib and file manipulation
    By unixOZ in forum Linux Programming
    Replies: 1
    Last Post: 03-22-2004, 09:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21