Thread: Error occurs when adding #include?

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    24

    Error occurs when adding #include?

    I'm working with the Wireshark code, revision 32343. If you're familiar with Wireshark, I'm adding a tap plugin for the aim_messaging dissector. My problem is, whenever I add
    #include <tap.h> to the dissector (as the README.tapping file tells me to do) and then rebuild the project, tap.h generates compile errors. If I remove the include, it goes back to building just fine. I haven't made any other changes to the code aside from adding the include, and I am confused. Thank you for any suggestions.

  2. #2
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    How about posting the errors you get.

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    24
    register.c
    packet-aim-messaging.c
    c:\wireshark\epan\tap.h(31) : error C2143: syntax error : missing ')' before '*'

    c:\wireshark\epan\tap.h(31) : error C2081: 'packet_info' : name in formal parame
    ter list illegal
    c:\wireshark\epan\tap.h(31) : error C2143: syntax error : missing '{' before '*'

    c:\wireshark\epan\tap.h(31) : error C2371: 'epan_dissect_t' : redefinition; diff
    erent basic types
    c:\wireshark\epan\epan.h(32) : see declaration of 'epan_dissect_t'
    c:\wireshark\epan\tap.h(31) : error C2143: syntax error : missing ';' before '*'

    c:\wireshark\epan\tap.h(31) : error C2059: syntax error : 'type'
    c:\wireshark\epan\tap.h(31) : error C2059: syntax error : ')'
    c:\wireshark\epan\tap.h(43) : error C2143: syntax error : missing ')' before '*'

    c:\wireshark\epan\tap.h(43) : error C2081: 'packet_info' : name in formal parame
    ter list illegal
    c:\wireshark\epan\tap.h(43) : error C2143: syntax error : missing '{' before '*'

    c:\wireshark\epan\tap.h(43) : error C2059: syntax error : 'type'
    c:\wireshark\epan\tap.h(43) : error C2059: syntax error : ')'
    c:\wireshark\epan\tap.h(51) : error C2146: syntax error : missing ')' before ide
    ntifier 'tap_packet'
    c:\wireshark\epan\tap.h(51) : error C2081: 'tap_packet_cb' : name in formal para
    meter list illegal
    c:\wireshark\epan\tap.h(51) : error C2061: syntax error : identifier 'tap_packet
    '
    c:\wireshark\epan\tap.h(51) : error C2059: syntax error : ';'
    c:\wireshark\epan\tap.h(51) : error C2059: syntax error : ','
    c:\wireshark\epan\tap.h(51) : error C2059: syntax error : ')'
    NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
    \cl.EXE"' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
    \nmake.exe"' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
    \nmake.exe"' : return code '0x2'
    Stop.

    c:\wireshark>

    I don't understand why the syntax errors would pop up after I include it in my dissector.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Well, look at the .h file that pops up. Does it look ill-formed? I've found this file which appears to be what you're looking at. If so, that means that packet_info isn't recognized as a type. I don't know where that comes from, but wherever it is, you need to include that too.

  5. #5
    Registered User
    Join Date
    Apr 2010
    Posts
    24
    You can browse the code I'm modifying here: [Wireshark] Index of /releases/wireshark-1.2.7/epan
    tap.h is in that directory, and I'm modifying packet-aim-messaging.c in the dissector subdirectory.
    I'll look at it more closely in a little while, I'm just confused as to why this would popup when simply being included. Thank you for your help thus far.

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by Dest View Post
    I'll look at it more closely in a little while, I'm just confused as to why this would popup when simply being included.
    The answer to that is obvious: that's the file that's "broken".

    You can either search through your sources for that word, or more likely, you should be getting an error like "can't include <whatever> as file not found".

  7. #7
    Registered User
    Join Date
    Apr 2010
    Posts
    24
    Including an additional file (in this case packet.h) solved the problem.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. file i/o dilemma
    By adramalech in forum C Programming
    Replies: 27
    Last Post: 11-11-2008, 12:30 AM
  2. Unable to open include file SDL_audio.h
    By rraj.be in forum C Programming
    Replies: 2
    Last Post: 06-28-2008, 08:04 PM
  3. does not name a type ERROR
    By DarrenY in forum C++ Programming
    Replies: 3
    Last Post: 10-13-2007, 04:54 AM
  4. Read and write hanging
    By zee in forum C Programming
    Replies: 8
    Last Post: 08-03-2004, 11:19 PM
  5. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM

Tags for this Thread