Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

[Linker error] undefined reference to 'WinMain@16'

kc2keokc2keo Posts: 110Member
First of all I am working on the helloworld example with jni. I am using BloodShed dev c++ for my compiler. I have downloaded jni.h, jnipost.h from searching at google.com and putting them in the #include directory. Everything seems to go fine execpt for the error which is the name of this thread. I made the header stub from my helloworld java file and also put it in the include directory which is in my compiler root directory. I am also aware that some of the code generated in the header file has to be the same in the .c file. I hope i'm explaining this right.

Anyway heres the link to the tutorial:

http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/index.html

After I make the native code implementation i'll have to make the shared library and i'm also not sure how to. I know I have the option to make one in my compiler but I don't know what to do from there.

Any help would be great,

Thanks in advance,
George Mouyios

Comments

  • stoberstober Posts: 9,765Member ✭✭✭
    in Dev-C++ you need to create a dll project, not an executable project.
  • kc2keokc2keo Posts: 110Member
    : in Dev-C++ you need to create a dll project, not an executable project.
    :


    So all I need to do is make a new project as a dll project and then just paste the code in and compile it?

    George
  • stoberstober Posts: 9,765Member ✭✭✭
    : : in Dev-C++ you need to create a dll project, not an executable project.
    : :
    :
    :
    : So all I need to do is make a new project as a dll project and then just paste the code in and compile it?
    :
    : George
    :

    you also need to export any symbols that is to be called from the application program. Otherwise, that's about all there is to it. Pretty simple stuff actually.
  • kc2keokc2keo Posts: 110Member
    Thanks for your help. If I had no response I would be still stuck trying to get the executable file to work when it was supposed to be a dll file shared library.

    Thanks
    George
  • kc2keokc2keo Posts: 110Member
    This is the site where I had gotten the tutorial about working with the java native interface:

    http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/index.html

    I don't think I mentioned that before.

    Bye from,
    George
  • kc2keokc2keo Posts: 110Member
    I have gotten to step 5 which is compile and load the shared library. I compiled the shared library but I cannot load it. Step 6 tells me to run the program using the java intrepreter. When I run HelloWorld.class I get the error saying:

    no hello in java.library.path

    Yeah its a path thing. Does that mean I should put something in the include directory with my compiler?
Sign In or Register to comment.