Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 12-18-2014, 03:25 AM   #1
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
./ list.txt
I took a look at the "" file. It is below:



    while read PDF
        echo "HOLD ON ${PDF}..." 
        ./ ${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 "" file is:

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

So I already know that 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 "" runs first, then calls "", so how can "PDF" be assigned to "list.txt", when that assignment was in "" not ""?

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:

could not open the somethingelse file for read
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 03:28 AM.
Old 12-18-2014, 04:23 AM   #2
Senior Member
Registered: Mar 2004
Location: england
Distribution: Debian, Mint, Puppy, Raspbian
Posts: 3,421

Rep: Reputation: 200Reputation: 200Reputation: 200
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, 04:24 AM   #3
John VV
LQ Muse
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,229

Rep: Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522Reputation: 2522
Adobe pdf's are not c++ code
an example of building a c++ program with a shell script

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

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
./something  --help


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 09:02 AM
where to put headers and cpp files vendtagain Programming 9 03-15-2010 09:50 AM
creating or deleting files in cpp milky.way Programming 2 11-27-2007 06:56 PM
gcc header files and cpp files? EchO Linux - Software 3 03-01-2005 02:14 AM
compiling .h and .cpp files with g++ arnab_be Linux - Newbie 2 03-03-2004 03:23 PM > Forums > Linux Forums > Linux - Newbie

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

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