LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-18-2014, 02:25 AM   #1
larryburns
LQ Newbie
 
Registered: Nov 2014
Posts: 19

Rep: Reputation: Disabled
Compiling cpp files with sh files?


I am having trouble understanding how my code is working. I am new to this project and never learned unix before. My coworker quickly showed me how to run the program but didn't explain how it worked

After making sure all the C++ files compiled properly by running make, he went to the command prompt and typed
Code:
./run.sh list.txt
I took a look at the "run.sh" file. It is below:

Code:
DIR=/directory/scripts/binaries/what

    LIST=$1

    while read PDF
    do 
        echo "HOLD ON ${PDF}..." 
        ./makeInputAX.sh ${PDF} ${PDF} >INPUT/${PDF}.something 
        ${DIR} -AX INPUT/${PDF}.something # I don't want to reveal the actual types of files I'm dealing with, so I called them 'something'
    done < ${LIST}
the "makeInputAX.sh" file is:

Code:
$PDF=1
    echo "THEFILE ABC/{PDF}.something"
and "list.txt" simply contains:

Code:
12345
So I already know that run.sh reads whats inside "list.txt", and assigns "12345" to be the "LIST" variable. I do see "HOLD ON 12345" in the command prompt. What confuses me is that I thought "run.sh" runs first, then calls "makeInputAX.sh", so how can "PDF" be assigned to "list.txt", when that assignment was in "makeInputAX.sh" not "run.sh"?

What also confuses me is that in the command prompt, I then see the outputs from the program, as they were written in the cpp files that are part of the project. However, those files are in a seperate directory, not in "/directory/scripts/binaries/what". I made changes to those cpp files and want to see the new outputs I should get, but I am getting an error:

Code:
could not open the somethingelse file for read
However,
Code:
could not open the ..
is not written anywhere in my C++ code. To fix that, do I need to look in my cpp files or is there something to these sh files that can help?

Last edited by larryburns; 12-18-2014 at 02:28 AM.
 
Old 12-18-2014, 03:23 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
ask your colleague.
better to ask ASAP than to leave it longer and longer.

don't be afraid to ask it shows a willingness to learn, not stupidity.
 
Old 12-18-2014, 03:24 AM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
Adobe pdf's are not c++ code
an example of building a c++ program with a shell script
BUILD.sh
Code:
#!/bin/sh

cd ../..
qmake-qt4 -project -after "CONFIG+=opengl" -after "QT+=xml opengl script"
qmake-qt4
make

cd Build/Linux

mkdir "Structure_Synth"
mkdir "Structure_Synth/Examples"
mkdir "Structure_Synth/Misc"
cp ../../trunk "Structure_Synth/structuresynth"
cp ../../LICENSE* "Structure_Synth"
cp -r ../../Examples/* "Structure_Synth/Examples"
cp -r ../../Misc/* "Structure_Synth/Misc"

cd "Structure_Synth"
rm -rf `find . -type d -name .svn`
cd ..


have you tried
Code:
./something  --help
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
compiling .cpp files leogg23 Linux - Newbie 3 11-19-2010 08:02 AM
where to put headers and cpp files vendtagain Programming 9 03-15-2010 08:50 AM
creating or deleting files in cpp milky.way Programming 2 11-27-2007 05:56 PM
gcc header files and cpp files? EchO Linux - Software 3 03-01-2005 01:14 AM
compiling .h and .cpp files with g++ arnab_be Linux - Newbie 2 03-03-2004 02:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration