Using pcap, dirent.h and error C2085, C2061

This is a discussion on Using pcap, dirent.h and error C2085, C2061 within the C Programming forums, part of the General Programming Boards category; Hi all, I'm new to using Visual Studio. I'm currently using VS .NET 2003 on Vista, and I'm trying to ...

  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    7

    Using pcap, dirent.h and error C2085, C2061

    Hi all,

    I'm new to using Visual Studio. I'm currently using VS .NET 2003 on Vista, and I'm trying to port a program from Linux to Windows.

    The program uses the pcap library. I have installed WinPcap 4.0.2 and downloaded the Developer's Pack WpdPack_4_0_2. However, I have no idea what to do with the developer's pack, i.e. what do I do with the pcap.h and other header files/libraries so my program can use the pcap functions.

    Also, one of the errors I've gotten was that the file dirent.h cannot be found. Is there some way to workaround this problem, i.e. some library that I can download and use so I don't have to change my code? If not, what are the alternatives?

    Lastly, I seem to get a lot of syntax errors. The program was able to compile and run without errors in Linux. One of these errors are "error C2085: '<function name>': not in formal parameter list." These errors occur in the header file which is in the following format:

    Code:
    #ifndef HEADER_H
    #define HEADER_H
    
    /* Bunch of #include and #define statements */
    /* Struct declarations */
    
    /* Here's where the errors are */
    static void *Function1(int n);
    int Function2(ABC *x);  //ABC is a self-defined structure declared in this header file
    ABC *Function3(void *a);
    static inline void Function4(unsigned char *c, unsigned char *d, int e);
    
    /* There is also a C2061: syntax error: identifier 'inline' for the following line */
    inline int Function5(ABC *x, unsigned char *f, int g);
    
    #endif
    Please advise.

    Thank you.

    Regards,
    Rayne

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    Read Compiler Error C2085 (C++) and see if that problem exists in your code.

    After doing that, post all of the code of the file the error is in, and copy and paste the exact error messages, which should point to the line the error is on. Also highlight the lines in question so we dont have to find the lines ourselves. If you comment everything (or the majority) out then we dont have anything to work with.

    Also, if you still have access to the working Linux code and can compile it on Linux, do so with arguments "-Wall -pedantic" and see if it gives any warnings, in which case you should post those if you dont know what they mean (along with the relevant code the warnings refer to, obviously).

Popular pages Recent additions subscribe to a feed

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