Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, I am trying to run a c++ program on my linux machine. My distro is Slackware 12.0. I think I have set correctly everything I need, but I am ...
  1. #1
    Just Joined!
    Join Date
    Sep 2008
    Posts
    32

    cannot run a c++ application on linux (minipar)

    Hello,

    I am trying to run a c++ program on my linux machine. My distro is Slackware 12.0. I think I have set correctly everything I need, but I am getting error messages, and I cannot run the program.

    Here is a summary of the things I have done, and the error messages I get. I am trying to run the demo of the Minipar parser, which I have downloaded from here (this is just for info):
    MINIPAR Home Page

    In the readme file, the only thing said is to set the minipath variable. I do it like this in my /etc/profile (I am using bash shell).

    MINIPATH=/home/maria/my_programs/minipar/data:$MINIPATH
    export MINIPATH

    Also, I've tried running the demo with specifying the path from the command line as it is shown in the readme file:
    pdemo -p ../data <A01
    The error message I've got is:
    -bash: pdemo: command not found
    My A01 file contains a single sentence "Mary likes chocolate".

    I also have tried:
    ./pdemo -p ../data <A01
    but I get:
    -bash: ./pdemo: No such file or directory

    I also have added pdemo in my path again in my /etc/profile:
    PATH= /home/maria/minipar/pdemo:$PATH
    export PATH
    Again I get the same error messages.

    As I can see the program is written in c++ (the file is pdemo.cpp) . I have both g++ and gcc in my /usr/bin. They should be enough for interpreting the program, right? As far as I understood I need one of these packages so that I can compile and interpret under linux programs written in c++. I hope these packages are on the right place in my case (in /usr/bin).
    Having added the pdemo in the path, I still get:
    -bash: pdemo: command not found
    when I try running it like this: pdemo -p ../data <A01
    (I've restarted after the changes).

    So, I have pdemo.cpp in minipar/pdemo, trying to run it by calling "pdemo" with the corresponding parameters: pdemo -p ../data <A01, and get the error messages above.

    I have been thinking that I might miss some other information (i.e. libraries), but I am not sure how to see what I miss. The readme file does not specifies anything else.
    I have downloaded the Minipar parser and haven't changed anything (except setting the minipath).

    There is no mailing list for this application. I know this post is rather specific, but I have tried different things, and it is still not working, and if I could get some feedback whether I do the general things right (setting the variables, trying to interpret the c++ program), this would be very helpful for me. Thank you.

    Regards

  2. #2
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    cpp file is the source for the application, you have to compile it first using g++ to create an executable, which you can run

  3. #3
    Just Joined!
    Join Date
    Sep 2008
    Posts
    32
    Thank you very much for the reply.

    I have actually managed to run the application, the problem seems to be that I have downloaded the wrong file. My dirsto is 32-bit, but I have downloaded this file:
    minipar-0.5-Linux.tgz
    instead of this one:
    minipar-0.5-Linux32.tgz
    In this second package, there was an executable file pdemo, and I didn't need to compile anything, just ran it successfully.

    While still trying the first one, I tried to compile the source file pdemo.cpp as you said, like this:
    g++ pdemo.cpp -o pdemo
    and I get the following error (this is just a snippet):
    /tmp/ccRGdJGO.o: In function `main':
    pdemo.cpp.text+0xf90): undefined reference to `initialize_minipar(char const*)'
    pdemo.cpp.text+0xfa4): undefined reference to `extract_features(char const*)'
    pdemo.cpp.text+0xfb3): undefined reference to `ParseTree::ParseTree()'
    (before doing this I have copied all .h files from /include into /pdemo.)

    There was also a makefile in /pdemo, and by running it:
    make
    and I get the following errors:
    g++ -o pdemo pdemo.o -I../include -L../lib -lminipar -lz -lm
    /usr/lib/gcc/i486-slackware-linux/4.1.2/../../../../i486-slackware-linux/bin/ld: cannot find -lminipar
    In my /lib I had just libminipar.a.

    I am not sure exactly why I get these errors.

    But the right package worked fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...