dcsimg
Problems in HelloWorldImp.c compilation
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Saturday, November 22, 2003 01:15 AM

Hi I'm newbe to this JNI. i wrote a sample program "HelloWorld.java" as guided in sun's jni tutorial. but when i come to creating shared libraries step i'm getting error like [root@B138 JNI]# cc -G -I/opt/j2sdk_nb/j2sdk1.4.2/include -I/opt/j2sdk_nb/j2sdk1.4.2/include/linux HelloWorldImp.c -o libhello.so cc: unrecognized option `-G' /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0x18): In function `_start': ../sysdeps/i386/elf/start.S:77: undefined reference to `main' collect2: ld returned 1 exit status actually i'm doing this under redhat linux 9. and using j2sdk1.4.2 i installed j2sdk-1_4_2-nb-3_5_1-bin-linux.bin (j2sdk + netbeans pack) a   More>>

Hi

I'm newbe to this JNI.

i wrote a sample program "HelloWorld.java" as guided in sun's jni tutorial. but when i come to creating shared libraries step i'm getting error like

[root@B138 JNI]# cc -G -I/opt/j2sdk_nb/j2sdk1.4.2/include -I/opt/j2sdk_nb/j2sdk1.4.2/include/linux HelloWorldImp.c -o libhello.so
cc: unrecognized option `-G'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0x18): In function `_start':
../sysdeps/i386/elf/start.S:77: undefined reference to `main'
collect2: ld returned 1 exit status


actually i'm doing this under redhat linux 9. and using j2sdk1.4.2

i installed j2sdk-1_4_2-nb-3_5_1-bin-linux.bin (j2sdk + netbeans pack) and installed in /opt/j2sdk_nb directory.
all my java programs are working normally. no probs with them.

actually i don't know what that -G and -I options will do.

i tried "cc --help" but no option like -G
so i just experiment with some more possibilities like .. and their outputs

[root@B138 JNI]# gcc -G -I/opt/j2sdk_nb/j2sdk1.4.2/include -I/opt/j2sdk_nb/j2sdk1.4.2/include/linux HelloWorldImp.c -o libhello.so
gcc: unrecognized option `-G'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0x18): In function `_start':
../sysdeps/i386/elf/start.S:77: undefined reference to `main'
collect2: ld returned 1 exit status


[root@B138 JNI]# gcc -g -I/opt/j2sdk_nb/j2sdk1.4.2/include -I/opt/j2sdk_nb/j2sdk1.4.2/include/linux HelloWorldImp.c -o libhello.so
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0x18): In function `_start':
../sysdeps/i386/elf/start.S:77: undefined reference to `main'
collect2: ld returned 1 exit status


every time i'm getting this error...i don't know how to solve this...should i include main function in that HelloWorlsImp.c file?.

plz help me...
Vali

   <<Less
About | Sitemap | Contact