Problems in HelloWorldImp.c compilation

Hi I'm newbie 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?.
I know this might be a silly thing.. but as a newbie i don't know what to do.
plz help me... Vali

Hallo,
I am no Linux expert so I cannot help you directly, but I do know that similar queries have been answered in the past in this forum. Try searching the forum.

Similar Messages

  • Any problems running a program compiled with SDK 1.4.2_14 with JRE 1.4.2_08

    Hi,
    Would there ever be a problem running a program compiled in Java 1.4.2_13 with JRE 1.4.2_08?
    Why or why not? No guesses please.
    Thanks

    No such hope. The alternative to testing is to review changes made to each version leading up to 14. This is spelled out in each version's Release Document. There are a lot of changes. Most will not affect your program. Each change is relatively well described, but your problem will be to decide if your program will be affected by the change.
    Or, do nothing, hope like hell that nothing breaks, and have an up-to-date copy of your resume.
    If someone came to me saying a program couldn't be tested, I'd have serious concerns for that person's future.

  • Problem when trying to compile servlets!

    Hi,
    Can someone help me with my problem.
    I have installed jakarta-tomcat-1.4.27 after instructions from the book 'Core Servlets and JavaServer Pages' but I have one problem. When I compile a servlet I get the following message:
    C:\Apache-Tomcat-4.1.27\jakarta-tomcat-4.1.27\webapps\ROOT\WEB-INF\classes>javac HelloServlet.java
    HelloServlet.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    HelloServlet.java:3: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    HelloServlet.java:13: cannot resolve symbol
    symbol : class HttpServlet
    location: class HelloServlet
    public class HelloServlet extends HttpServlet {
    ^
    HelloServlet.java:14: cannot resolve symbol
    symbol : class HttpServletRequest
    location: class HelloServlet
    public void doGet(HttpServletRequest request,
    ^
    HelloServlet.java:15: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class HelloServlet
    HttpServletResponse response)
    ^
    HelloServlet.java:16: cannot resolve symbol
    symbol : class ServletException
    location: class HelloServlet
    throws ServletException, IOException {
    ^
    6 errors
    What is the problem, and how will i fix the problem? I think there is some problem with the CLASSPATH, but I don't now what!
    My classpath looks as follows:
    set JAVA_HOME=C:\j2sdk1.4.1_01;CLASSPATH=.;C:\ServletDevel;C:\Apache-Tomcat-4.1.27\jakarta-tomcat-4.1.27\common\lib\servlet.jar
    N.B. I use Java version j2sdk1.4.1_01!

    OK, I have tried to do this but it does n't solve my problem. Maybe my problem is that I don't put my environment variables in a proper way (my windows knowledge is not the best). How will I set this variables in a proper way? I use windows XP Pro.
    Now I have put all my variables in one row as follows:
    Variable name: set
    Variable value: JAVA_HOME=C:\j2sdk1.4.1_01;CLASSPATH=.;C:\ServletsDevel;C:\Apache-Tomcat-4.1.27\jakarta-tomcat-4.1.27\common\lib\servlet.jar;C:\j2sdk1.4.1_01\bin
    Is this correct, or how will I make this in a proper way?
    N.B. I must restart my computer each time I have changed my settings, isn't that right?

  • Cover Flow Sort Problem To Do With Compilations?

    Hi,
    I just had a thought. Do you think the problem we're having with Cover Flow on the iPod Nano is to do with "Part of a compilation" not being ticked in iTunes?
    If you bought one movie soundtrack Album that has a different Artist for each track, should "Part of a compilation" be ticked in iTunes, even if you've set the Album Artist to "Various Artists"?

    No. does not help. The Compilations-Checkmark brings the files in a folder and not one level up. So the iTunes folder is a little cleaned up.
    mk

  • Problem by BPEL process compilation with JDeveloper

    Hi,
    I don't quite know whether my problem is in the JDeveloper forum or Oracle Process Manager one.
    I am currently trying to execute a process, with dynamic invocation and dynamic management capabilities, but I won't go into technical details. In the WSDL Definition for the process I have defined 2 partnerLinkTypes - one for the standard synchronous request/response (receive-reply) and one for my management port (asynchronous receive).
    The end of the WSDL Definition is as follows:
    <portType name="ConfigurationPort">
    <operation name="ConfigurationChanged">
    <input message="client:ConfigMessage"/>
    </operation>
    </portType>
    <portType name="DynamicDBServiceProcess">
    <operation name="process">
    <input message="client:DynamicDBServiceProcessRequestMessage"/>
    <output message="client:DynamicDBServiceProcessResponseMessage"/>
    </operation>
    </portType>
    <plnk:partnerLinkType name="DynamicDBServiceProcess">
    <plnk:role name="DynamicDBServiceProcessProvider">
    <plnk:portType name="client:DynamicDBServiceProcess"/>
    </plnk:role>
    </plnk:partnerLinkType>
    <plnk:partnerLinkType name="ConfigPartner">
    <plnk:role name="Reconfigure">
    <plnk:portType name="client:ConfigurationPort"/>
    </plnk:role>
    <plnk:role name="ReconfigureResponse">
    <plnk:portType name="client:ConfigurationPort"/>
    </plnk:role>
    </plnk:partnerLinkType>
    The JDeveloper BPEL compiler is supposed to generate the binding and service tags for my abstract portTypes, but the binding and service for my ConfigurationPort are somehow wrong generated:
    <binding name="DynamicDBServiceProcessBinding" type="tns:DynamicDBServiceProcess">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="process">
    <soap:operation style="document" soapAction="process"/>
    <input>
    <soap:body use="literal"/>
    </input>
    <output>
    <soap:body use="literal"/>
    </output>
    </operation>
    </binding>
    <binding name="ConfigurationPortBinding" type="tns:ConfigurationPort">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="ConfigurationChanged">
    <soap:operation style="document" soapAction="ConfigurationChanged"/>
    <input>
    <soap:header message="tns:WSARelatesToHeader" part="RelatesTo" use="literal" encodingStyle=""/>
    <soap:body use="literal"/>
    </input>
    <output>
    <soap:body use="literal"/>
    </output>
    </operation>
    </binding>
    <service name="DynamicDBServiceProcess">
    <port name="DynamicDBServiceProcessPort" binding="tns:DynamicDBServiceProcessBinding">
    <soap:address location="http://I71NB60:9700/orabpel/default/DynamicDBServiceProcess/2.4"/>
    </port>
    </service>
    <service name="ConfigurationPortService">
    <port name="ConfigurationPortPort" binding="tns:ConfigurationPortBinding">
    <soap:address location="http://set.by.caller"/>
    </port>
    </service>
    I tried to find some configuration property for the project in order to properly modify the generation of my soap:address location (it surely isn't http://set.by.caller/). Nevertheless the process compiles fine and is successfully deployed, but at runtime an exception is generated because of "java.sql.SQLException: [POL-3221] Null-Schl?ssel in prim?rem Index" (trying to insert a NULL key in the primary Index). Has anyone know how to tune my project (or compiler) settings in order to generate a proper binding and service?
    Best regards,
    Genadi Genov

    Try posting on the BPEL forum BPEL

  • Problem with pro*c compilation and linking

    Hi all,
    I have a problem running the pro*c program on an windows environment.
    I have oracle9i and visual studio .net. Ya kinda strange about the combo, but need to live with it.
    I create a .pc file and precompile it using oracle pro*c/c++ precompiler. so now I got the .c file.
    I used .net command line to compile this .c file
    It gave me the .obj file. Now I am getting a link error. I am not sure how I need to link the linkfile.
    Let me know if you have any suggestions.
    Thank you,
    -Raghu

    Make sure you are including the Pro*C library. The platform docs tell you explicitly what the library name is. I think for 9i it is called orasql9.lib.

  • Problem with path and compiling

    I am trying to compile a class where I have and object I created as well. It complains that it cannot find that object (or class in the classpath) and fires this error when I try to compile:
    Error: csci5433.database.animals.Pets.customerName is declared to be of type csci5433.database.customer.Customer and class csci543
    3.database.customer.Customer can't be located in the classpath.
    Now, when I add the class file to the classpath it fires this other error:
    Exception in thread "main" java.lang.NoClassDefFoundError: and
    Customer class does not have a main method or anything of the like and when I compile that class it compiles without problem.
    Thanks!

    You don't put full paths to class files in the classpath. You just put in jar files and directories that hold the classes. And the directories should reflect the package structure. So if there's a file c:\monkey\cow\Horse.class, and Horse is a class in the package "cow", then the classpath should include "c:\monkey", and that's it. It shouldn't include c:\monkey\cow\ or c:\monkey\cow\Horse.class.
    Also try to remember that most things in java take class names, not file names. In the above example, the full name of the Horse class is "cow.Horse". Except for the compiler, one almost never mentions filenames.
    So I'm guessing that you specified the classpath incorrectly, and you created your jars incorrectly.
    I'm still confused why the compiler would say:Exception in thread "main" java.lang.NoClassDefFoundError: andWhere did you ever use the word "and"?

  • Problem with package and compile

    I am new to Java. I am currently using Java in developing a simple system. However, my system need to import other external classes.
    The main problem is i dont know how to compile this file when they are in separate folder (i am using windows). Let say the main .java is in one folder and other external .java in other folders. I knew this can be done with the use of package. the problem is when i try to compile, there is a problem.
    I used to refer from the below link for many times, but still cannot get it.
    http://java.sun.com/j2se/1.3/docs/tooldocs/win32/javac.html
    can anyone provide me the most simple way of:
    1. import from external classes into my main system
    e.g: import com.jrefinery.report.Element;
    2. how to compile all .java from different directory
    3. after i compile, i need the .class files place in other directory
    advanced thanks to those who able to provide help.
    Sosan

    can anyone provide me the most simple way of:
    1. import from external classes into my main system
    e.g: import com.jrefinery.report.Element;You can use the -classpath option with javac, specifying the path of your external classes.
    javac -classpath C:/classes D:/classes
    2. how to compile all .java from different directoryYou simply indicate the path of the different sources files one after the other, like that :
    However, you really should put all your source files in the same package unsig the package instruction. All files that belong to the same package must reside in the same directory indicated by the package name. Look up some doc about the package instruction.
    javac -classpath C:/classes D:/classes C:/source/myclass.java D:/source/myClass.javaYou should put all the source files in 1 directory an compile using the * wildcard by :
    "javac C:/sources/*.java" for example
    3. after i compile, i need the .class files place in
    other directoryuse -d option with javac to specify the output directory :
    javac -classpath C:/classes D:/classes -d C:/outputdir C:/source/myclass.java D:/source/myClass.javaTo simplify things, put all source files in the same directory and put a copy of each external package you use in this directory. So you won't have to use classpath.
    I also suggest you write a .bat file to do all the operations at once, and stick with it so that each time you change something in the sources you won't have to go through all the steps.
    Beware, because path issues in java can be very tricky.

  • Problems with GCC version - compiling OpenOffice

    I am trying to compile OpenOffice 4.1.1 to run on 10.6.8. When I run the ./configure it runs for a few seconds then shows the following error:
    "checking the GNU gcc compiler version... configure: error: found version "1.0.2", use version 3+ of the gcc compiler"
    If I run:
    gcc -v
    I get:
    gcc version 4.2.1 (Apple Inc. build 5659)
    Any ideas on how to fix this?
    Thanks

    I suppose the real incentive is to be able to just continue using 10.6. But it seems from other feedback that the problem with OpenOffice 4.1 is dependencies on libraries in 10.7, rather than the GCC version. I know that I could probably eventually code around those dependencies, but it would certainly involve more time and effort than I am currently able to devote to it.
    I have tried LibreOffice in the past, but frankly I found it so horrible and slow (I think because of its dependency on Java) that I ended up using the X11 version of OpenOffice - which in itself was not a terrific user experience, but was a lot better than the alternative.
    I will try the version you have mentioned, but I also note that this is planned to be obsolete by May next year, and is also the last version that will support 10.6 or 10.7 (10.8 will be the lowest requirement). Which will leave a fair number of 64-bit intel machines unsupported, since some of those are only able to run 10.7. Thanks for the feedback.

  • WITH HOLD problem when  common_parser=yes compiler option used

    Hi guys,
    we are using Oracle 11g precompiler and we start using "common_parser=yes" option because of JOIN keyword, but now WITH HOLD in DECLARE CURSOR statements is not supported.
    So, the statement :
    EXEC SQL DECLARE cur_name CURSOR WITH HOLD FOR SELECTc1, c2 FROM t1
    gives an error when "common_parser=yes" is present
    PCC-S-02201, Fand das Symbol "WITH" als eines der folgenden erwartet wurde:
    for,
    and when is not, we can compile this statement but we get the same error for JOIN (and we dont wont to rewrite JOIN statemnts to old syntax with +).
    Is this a bug and is there a workaround or solution for this problem?
    Thanks in advance,
    DO
    PS
    We also noticed the same problem for LOB statements:
    EXEC SQL LOB WRITE ONE :lob FROM :buffer WITH LENGTH :bufferlen ...
    Again, WITH is not recognised
    Edited by: 976549 on 13.12.2012 02:20

    Hi,
    I don't have much information I can provide but this looks like an unpublished bug: Bug 8436316 - PARSER UNIFICATION: CURSOR WITH HOLD IS NOT SUPPORTED
    The best I can say at this time is if you have a support contract to open a Service Request with My Oracle Support for any alternatives.
    I know that is not much help but it does seem like this is a known bug (but no workaround that I have seen).
    Regards,
    Mark

  • Problems using alchemy windows compiling .swc

    Hi there,
    yesterday I installed cygwin and configured alchemy in a correct way. => It worked
    I have some problems setting the path variable but I solved them with adding the directories to the windows path variable => cygwin reads and uses them.
    Today I started my pc and nothing works. There is now error. I tried everything. I run the config script again and it run successfully. But if I try to compile a swc nothing happens. The PC works for a while and then I can again type a new command line. Now error, now success report AND no swc file.
    Can anybody help me, please?

    I've encountered a similar problem in the past.  I found that if I entered the "alc-on" command and then displayed the path "echo $PATH" I had 2 entries for the $ALCHEMY_HOME/ahacks directory in the path. Removing one of those entries fixed the problem.
    To ensure I used the correct gcc/g++ after entering "alc-on" I choose to omit the $ALCHEMY_HOME/ahacks path addition described in the instructions.  I suspect my solution may not be the best.  I haven't investigated too deeply why this worked but it did fix the exact problem you are describing.

  • Problem getting things to compile.

    I need someone to help me because I can't compile my programs. When i'm in ms-dos prompt and try to compile, it just say bad file name. Anyone know possible problems. Thanks

    Try this (if you're using a version other than 1.4.1, just make the apprppriate changes):
    This may duplicate some of what you've already done, if so fine. But please verify you've done exactly what is written or know why you shouldn't before proceeding. You may want to print these instructions before continuing.
    To download the current version of Java, go here:
    http://java.sun.com/j2se/1.4.1/download.html
    and click on the word DOWNLOAD in the column labeled SDK in this line:
    Windows (all languages, including English)
    After downloading, click on this page of installation instructions and read through #6:
    http://java.sun.com/j2se/1.4.1/install-windows.html
    NOTE: If you are installing on other than a standard 32-bit Windows system, go to this page
    http://java.sun.com/j2se/1.4.1/install.html and choose the installation instructions for your system.
    Install the software according to the preceeding instructions
    Below is a Helloworld program, copy and paste it into your editor and save it as "HelloWorld.java" Use capitalization, Java is case-sensitive. If you're using Notepad, quote the name when saving, otherwise Notepad adds ".txt" to the name. Go to DOS/command window and check that you've got the file where you want it and that it's named correctly.
    -------program HelloWorld.java--------
    public class HelloWorld {
    public static void main (String[] args) {
    System.out.println("Hello World!");
    In the same directory as HelloWorld.java, enter "javac" - the program should print out a list of options, if not, set your PATH - see below.
    In the same directory as HelloWorld.java, enter "javac HelloWorld.java" and the javac compiler will create HelloWorld.class. If it was successful it will not give any messages. Check that the file is created.
    In the same directory as HelloWorld.java, enter "java -classpath . HelloWorld" with the spaces and the period. The program will run.
    Here is additional information:
    The Windows path is a set of pointers that Windows uses to locate programs that you execute, like javac.exe and java.exe. This setting is explained here:
    http://java.sun.com/j2se/1.4.1/install-windows.html
    Scroll down to: 5. Update the PATH variable
    (you should have already done this as part of the Java installation)
    The CLASSPATH is another set of pointers that is used by Java to find the files that you create and want compiled and/or run. This setting is explained here:
    Setting the Classpath:
    http://java.sun.com/j2se/1.4.1/docs/tooldocs/windows/classpath.html
    [NOTE: always start your classpath with ".;" which means the current directory. See my classpath, below]
    How Classes are Found:
    http://java.sun.com/j2se/1.4.1/docs/tooldocs/findingclasses.html
    Examples:
    This is my path
    PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\BATCH;C:\J2SDK1.4.1\BIN;C:\PROGRA~1\UTILIT~1;C:\PROGRA~1\WIN98RK
    This is my classpath
    CLASSPATH=.;C:\mjava;C:\mnrx;C:\NetRexx\lib\NetRexxC.jar;C:\j2sdk1.4.1\lib\tools.jar;C:\NetRexx\NrxRedBk

  • Using MS Visual Studio C++ 2008 Express, the "LoadLibrary" function doesn't recognize the NI-VISA DLL: "visa32.dll". I've included all the paths to the DLL. Is there a problem with this C++ compiler?

    I'm using MS Visual Studio C++ 2008 Express.  I've included all the paths to the DLL, "visa32.dll" but the LoadLibrary("visa32.dll") call returns the statement that can't convert character string to LPCSTR (pointer).  I ran the same code with the Portland Group compiler (which I no longer have) and there was not a problem accessing the DLL.  Is there some requirement for the C++ 2008 Express compiler that needs to be met?

    Hello jterry,
    If you compile as Unicode you need to pass Unicode strings to
    Win32 APIs which have LPTSTR or LPWSTR string.
    When you want to write code compilable for Unicode
    and Ansi just enclose all string constants in _T(). In your case:
    LoadLibrary(_T("visa32.dll"))
    You can look at this post on the microsoft discussion forums for more information.  Have a great day.
    O. Proulx
    National Instruments
    www.ni.com/support

  • Problem trying to run compile jsp containing JSTL tags

    Hi,
    I am facing a problem regarding compiling jsp containing JSTL tags.
    Can anybody help me out?

    Yes it is giving an error when i try to compile the jsp.
    And it's giving error on the include of the taglib in the jsp as
    C:\dev\ppdev\DOMA\jspcompile\WEB-INF\jstl\c-rt.tld" is an invalid archive file!
    Actually we are not using th default entry for taglib. Instead we have made an entry in the web.xml. Like this
    <taglib>
    <taglib-uri>/WEB-INF/c.tld</taglib-uri>
    <taglib-location>/WEB-INF/jstl/c.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/WEB-INF/c-rt.tld</taglib-uri>
    <taglib-location>/WEB-INF/jstl/c-rt.tld</taglib-location>
    </taglib>
    And using this uri in the jsp page like this
    <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
    <%@ taglib uri="/WEB-INF/c-rt.tld" prefix="c_rt" %>
    And when we try to compie the jsp its giving the error.
    C:\dev\ppdev\DOMA\jspcompile\WEB-INF\jstl\c-rt.tld" is an invalid archive file!
    I would appreciate your help and update me if any more information is required.

  • Problem while Pro*C compilation on Unix after 10g database migration.

    I am getting the following error while compiling Pro*C code after 10g Database migration,
    ld: 0706-006 Cannot find or open library file: -l trace10
    ld:open(): A file or directory in the path name does not exist.
    I am using a Makefile for compilation and this makes direct reference to library -ltrace10
    The $LIBPATH value is : /oracle/app/oracle/product/10.2.0/ora10gdb/lib:/usr/lib:/lib
    Please guide.
    Thanks in advance
    Kaustubh

    I am getting the following error while compiling Pro*C code after 10g Database migration,
    ld: 0706-006 Cannot find or open library file: -l trace10
    ld:open(): A file or directory in the path name does not exist.
    I am using a Makefile for compilation and this makes direct reference to library -ltrace10
    The $LIBPATH value is : /oracle/app/oracle/product/10.2.0/ora10gdb/lib:/usr/lib:/lib
    Please guide.
    Thanks in advance
    Kaustubh

Maybe you are looking for

  • Very slow printing in Illustrator

    I have been trying to print a clients pdf illustration files in Illustrator and it takes between 8 to 20 minutes to print a single page. (I have approx. 100 pgs to print). I  tried changing formats to an EPS or AI and then printing. The same thing ha

  • Creating dual monitor workspace

    I found one ancient message from September with absolutely no responses, so let's try again..... Bridge CS4. Dual monitors. HOW do I create and SAVE a workspace that takes advantage of both monitors? I want to put previews and some palettes on one mo

  • Open JTabbedPane with focus in tab

    I have a swing standalone app where general navigation is managed with something like this:    private void addNewComponent(JComponent component) {       JComponent panel = main.getDesktopComponent();       main.setMainTittle(GlobalOptions.getTittle(

  • Lightroom Upgrade from version 2 to 3.2

    Just upgraded to 3.2, when I close down 3.2 I get a prompt to update catalogue but the catalogue it suggests is for version2. Should I somehow convert current catalogue to 3.2 or leave as is. And if change how do i do this? ~Thanks

  • Cluster servers (file servers)

    Hello, We are looking to use Windows 2012 servers as a file server.  We want high availability so we like the concept of the cluster.  We like the ability to take one server down for maintenance and still be able to provide files to end users. I have