473,387 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

problem to compile with...

os2
hi

i tried to improve performance on for some trigonometry calcule

i read
http://www.javaworld.com/javatips/jw-javatip141.html?

i do

tmp@linux:~/bench> echo $CLASSPATH
/usr/lib/j2sdk1.4.2_03:/home/tmp/bench/java
tmp@linux:~/bench> javac MathLib.java

tmp@linux:~/bench> javah -jni -o MathLib.h -classpath . MathLib

i have some error with this command..

tmp@linux:~/bench> gcc -I/usr/lib/j2sdk1.4.2_03
-I/usr/lib/j2sdk1.4.2_03/include/linux Math.c -o MathLib.so
/usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../../crt1.o(.text+0x18): in
function « _start »:
.../sysdeps/i386/elf/start.S:98: undefined reference to `main'
/tmp/cc8K7UyJ.o(.text+0x1c): in function « Java_MathLib_sin »:
: undefined reference to `sin' /tmp/cc8K7UyJ.o(.text+0x41): in
function « Java_MathLib_cos »:
: undefined reference to `cos' /tmp/cc8K7UyJ.o(.text+0x66): in
function « Java_MathLib_sqrt »:
: undefined reference to `sqrt'
how to resolve that?
MathLib.java file

public class MathLib
{
public static native double sin(double radians);
public static native double cos(double radians);
public static native double sqrt(double value);

static
{
System.loadLibrary("MathLib");
}
}
Math.c file
#include <jni.h>
#include <math.h>
#include "MathLib.h"
#include <stdio.h>

JNIEXPORT jdouble JNICALL Java_MathLib_sin(JNIEnv *env, jobject obj,
jdouble value)
{
return(sin(value));
}

JNIEXPORT jdouble JNICALL Java_MathLib_cos(JNIEnv *env, jobject obj,
jdouble value)
{
return(cos(value));
}

JNIEXPORT jdouble JNICALL Java_MathLib_sqrt(JNIEnv *env, jobject obj,
jdouble value)
{
return(sqrt(value));
}


MathLib.h is generate automatically by javah....

/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class MathLib */

#ifndef _Included_MathLib
#define _Included_MathLib
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: MathLib
* Method: sin
* Signature: (D)D
*/
JNIEXPORT jdouble JNICALL Java_MathLib_sin
(JNIEnv *, jclass, jdouble);

/*
* Class: MathLib
* Method: cos
* Signature: (D)D
*/
JNIEXPORT jdouble JNICALL Java_MathLib_cos
(JNIEnv *, jclass, jdouble);

/*
* Class: MathLib
* Method: sqrt
* Signature: (D)D
*/
JNIEXPORT jdouble JNICALL Java_MathLib_sqrt
(JNIEnv *, jclass, jdouble);

#ifdef __cplusplus
}
#endif
#endif

any idea?
Nov 14 '05 #1
2 1948
"os2" <ma*******@yahoo.com> wrote in message
news:84*************************@posting.google.co m...
hi

i tried to improve performance on for some trigonometry calcule

i read
http://www.javaworld.com/javatips/jw-javatip141.html?

i do

tmp@linux:~/bench> echo $CLASSPATH
/usr/lib/j2sdk1.4.2_03:/home/tmp/bench/java
tmp@linux:~/bench> javac MathLib.java

tmp@linux:~/bench> javah -jni -o MathLib.h -classpath . MathLib

i have some error with this command..

tmp@linux:~/bench> gcc -I/usr/lib/j2sdk1.4.2_03
-I/usr/lib/j2sdk1.4.2_03/include/linux Math.c -o MathLib.so
/usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../../crt1.o(.text+0x18): in
function « _start »:
../sysdeps/i386/elf/start.S:98: undefined reference to `main'
/tmp/cc8K7UyJ.o(.text+0x1c): in function « Java_MathLib_sin »:
: undefined reference to `sin' /tmp/cc8K7UyJ.o(.text+0x41): in
function « Java_MathLib_cos »:
: undefined reference to `cos' /tmp/cc8K7UyJ.o(.text+0x66): in
function « Java_MathLib_sqrt »:
: undefined reference to `sqrt'
how to resolve that?


Pass -lm option to your gcc. BTW 2 things

a) Your issue is covered in FAQ.
c) It's OT in comp.lang.c a better place would have been
comp.programming.

<snip code>
--
Imanpreet Singh Arora
Zmoc.Zliamg@Zteerpnami
Remove Z to mail
"Things may come to those who wait, but only the things left by those who
hustle."
Abraham Lincoln
Nov 14 '05 #2
On 14 Oct 2004 11:14:35 -0700, ma*******@yahoo.com (os2) wrote in
comp.lang.c:
hi

i tried to improve performance on for some trigonometry calcule

i read
http://www.javaworld.com/javatips/jw-javatip141.html?

i do

tmp@linux:~/bench> echo $CLASSPATH
/usr/lib/j2sdk1.4.2_03:/home/tmp/bench/java
tmp@linux:~/bench> javac MathLib.java

tmp@linux:~/bench> javah -jni -o MathLib.h -classpath . MathLib

i have some error with this command..


Absolutely everything about Java is off-topic here. I suggest that
you ask this in a Java group.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jesper | last post by:
Hi I am currently following the tutorial from IBM (http://www-106.ibm.com/developerworks/xml/edu/x-dw-xjaxb-i.html) I have three problems at the moment. 1. It says else where that when the...
7
by: SC Shin | last post by:
Hi, everyone I've got problem. I am able to compile following code without error on Compaq, Linux machine But I am not able to compile this with error on Sun with forte7 compiler: line 26:...
3
by: Christopher M. Lusardi | last post by:
Hello, THE PROBLEM ----------- If I compile parts of my program with CC, and C, using extern "C" as appropriate it compiles without any errors, but it does a segmentation fault when I run the...
5
by: Carmine Cairo | last post by:
Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new...
2
by: AlexS | last post by:
Hello, I have error when reading schema using XmlSchema. Read and then .Compile: System.Xml.Schema.XmlSchemaException: May not be nominated as the {substitution group affiliation} of any...
12
by: SJD | last post by:
I've just read Christoph Schittko's article on XmlSerializer: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp . . . and very informative it is too....
9
by: ludocluba | last post by:
Hello, here is my problem: I have 3 files: main.c toto.c toto.h: ----------------------------------------------------------- toto.h: #ifndef _toto_h #define _toto_h int var; void test(void);...
15
by: Ken Allen | last post by:
I have been developing a suite of assemblies over the past couple of weeks, and this afternoon somethign started misbehaving. If I do not run the IDE and compiler the code from the command line,...
14
by: Lee Franke | last post by:
I can't seem to figure this one out. Here is my class structure namespace name { public class foo { } }
1
by: prasath03 | last post by:
Hi, I am struggling with the following problem. Can somebody pls help me?. I am developing a wesbite for user can edit their files only, so i am going to develop a page for a Tree Structure in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.