Find the answer to your Linux question:
Results 1 to 6 of 6
Hi Everyone! I am newcomer in programming a Linux system for my N900. I am writing little first-step-applications for my N900 (Maemo Linux). Everything worked fine till now. I already ...
  1. #1
    Just Joined!
    Join Date
    Feb 2011
    Posts
    4

    Cannot create and install application which uses external .txt file.

    Hi Everyone!

    I am newcomer in programming a Linux system for my N900.

    I am writing little first-step-applications for my N900 (Maemo Linux). Everything worked fine till now. I already have own applications for the device, but non of them uses an external data file.

    Now I am trying to create an application for my N900 which uses an external .txt file. The package is created successfully, the application is installed successfully, however the binary does not see the .txt (maybe it is not in the package?).

    Something is wrong with the package, I think.

    I am using MADDE Developer 0.6.72 to create the project skeleton.
    I am using Qt creator for create the code. After once the code is created successfully then I am running the following commands in MADDE Developer 0.6.72 for the updated skeleton folder created above.

    I writed the following lines into MADDE developer:

    <<
    //create project sceleton

    MADDE-0.6.72 ~/madde
    - $ mad pscreate -t qt_simple skeleton
    Skeleton skeleton, type=qtprog created

    //The code has been edited to read a .txt file.
    //I created and included into the code the intended Debian folder structure.

    MADDE-0.6.72 ~/madde
    - $ cd skeleton

    MADDE-0.6.72 ~/madde/skeleton
    - $ mad qmake

    MADDE-0.6.72 ~/madde/skeleton
    - $ mad make

    MADDE-0.6.72 ~/madde/skeleton
    - $ mad dpkg-buildpackage
    >>


    My goal is to create simple program to my N900 which reads and displays a simple "Hello world!" string from an external file (e.g. from a.txt). Please help! I read all the articles about Debian packaging, but no solution.

    In other words: How to create a Debian package which includes a binary that uses external .txt file?


    Thank you for your help!

  2. #2
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,112
    Does your app return error messages? It would be nice to know
    if it is just failing to perform the function, or if it is looking
    for the file and not finding it.

  3. #3
    Just Joined!
    Join Date
    Feb 2011
    Posts
    4
    The application starts correctly however the "Hello world!" message from the .txt never displays. No error messages displays as well.

    Maybe this happens because of the .txt is not included into the package or it is in the wrong path?!
    My program displays the "Hello world!" message from the .txt if the program is running from Qt creator, so my code is OK.

    The problem could be with the package itself. I really don't know how to create a package in which the external .txt included successfully.
    Last edited by sakal; 02-14-2011 at 09:28 PM.

  4. #4
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,112
    I am not a programmer. Maybe if you post some code, someone may
    be able to help.

  5. #5
    Just Joined!
    Join Date
    Feb 2011
    Posts
    4
    My problem has been solved. Now I am able to create applications they using external files for my n900.

    Thank you all for your help!

  6. #6
    Just Joined!
    Join Date
    Feb 2011
    Posts
    4
    My problem has been solved. Now I am able to create external file using applications for my n900.

    If you want to create an app for your n900 which reads and displays data from an external file here are the steps what makes you happy:

    1. Download and install Qt creator.

    2. Set up the qmake and necessary folders in the options.

    3. Download and install MADDE Developer.

    4. Create the Project and package skeleton with MADDE using the following command:
    Code:
    mad pscreate -t qt_simple yourproject
    5. Edit the automatically created source code in the src folder. (In this case we are using a code that reads info from an external file e.g. data.txt) Save all.

    6. Open the .pro file and add the following lines to it:
    Code:
    INSTALLS    += data
    data.path  = /opt/txt
    data.files  = data.txt
    The data.path is the folder structure you will put into your package. (So you have to implement into your code the following path for the .txt: "/opt/txt/data.txt" )
    Data.files is the path where your data.txt exists. Now this is near your .pro file. (The .txt and the .pro is in the same folder.)

    7. Open MADDE and navigate to the folder where the .pro file exists and enter the following commands:
    Code:
    mad qmake
    mad make
    mad dpkg-buildpackage
    8. Your package is now ready to copy to the N900 and install.

    Enjoy!



    Thank you for your help!
    Last edited by sakal; 02-20-2011 at 01:10 PM.

Posting Permissions

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