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:
#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
Install it. Then, in the IDE's setup or in your project's settings set the
according paths to include files and libraries, so you can compile and link
with them.
> 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?
I believe that some parts of what is contained in dirent.h is actually
available. Since this is POSIX and not standard C, you will find that the
replacements are often prefixed with an underscore. Just exclude the
#include and see what you need.
> 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:
[...
> /* 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
Well, where in this file and how? It is customary to create a minimal
example that reproduces the problem, where is yours? ;)
Anyway, I think I can guess the problem: Either you must create a typedef
for 'ABC' or you must use 'struct ABC*' instead of just 'ABC*'. Any C
compiler should know that though, regardless of the OS it runs on.
> /* There is also a C2061: syntax error: identifier 'inline' for the
> following line */
> inline int Function5(ABC *x, unsigned char *f, int g);
I'm not sure when C started adding 'inline' as keyword. It could be that
VS2003 still doesn't know that. You might be luckier with __inline then. It
could be a follow-up error though, i.e. one generated as side effects from
earlier errors.
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
C99, but many compilers offered it as a keyword before then (or _inline or
__inline or #pragma inline or...) -Dinline=__inline should do the trick.
--
J.