What's wrong with this code?

Problem 1:
Error messages:

service.c(474): error C2061: syntax error : identifier 'main'
service.c(474): error C2059: syntax error : ';'
service.c(474): error C2059: syntax error : 'type'

offending line:
void _CRTAPI1 main(int argc, char **argv)
{

Platform: Visual studio 2010

Problem 2:
fatal error C1083: Cannot open include file: 'jni.h': No such file or directory
How do I link in jni.h?
Last edited on
The header file jni.h doesn't ring a bell for me. I would say it is not part of standard C++. Where did you get it from? What is it for?

Also, AFAIK, the main entry function should return an integer, so it should be either one of the below:

1
2
3
4
5
6
7
8
9
int _CRTAPI1 main(int argc, char **argv)
{
    ...
}

int _CRTAPI1 main()
{
    ...
}
The jni.h I know is the header for the Java Native Interface. Are you trying to interface with Java?

On my PC, jni.h is in the include drectory of the Java Development Kit. Adding that directory to your include path should fix the open include file error.

Andy

P.S. You don't link a header, you include it. You link to a library.
Topic archived. No new replies allowed.