Discussion:
Some questions regarding a3q2
(too old to reply)
xewang
2011-06-11 22:15:33 UTC
Permalink
I have some questions regarding question 2.

1. How do I use the shell interface to run a program?
normally I type the following in the terminal

g++ xxx.cc
./a.out

for q2, it says that I should be able to type

include xxx.cc to ran it.

Also if I want include to output to a file, would it be

include xxx.cc outfile.txt?

2. when I use this command on a simple file

cpp -P -C -traditional -cpp jane.cc

the output looks like this

jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: error: iostream: No such file or directory
jane.cc:2: warning: extra tokens at end of #include directive
jane.cc:2: warning: extra tokens at end of #include directive
jane.cc:2: warning: extra tokens at end of #include directive
jane.cc:2: warning: extra tokens at end of #include directive
jane.cc:2: warning: extra tokens at end of #include directive
jane.cc:2: warning: extra tokens at end of #include directive
jane.cc:2: error: iomanip: No such file or directory

plus the all the code in jane.cc

Should my include also generate something like that?

3. Also for the routine #include

do we defined it like this?

#define #include( ... ) ( ... )


4. To anyone taking CS 245, is there an assignment 3 due next week? or
it's postponed because of the midterm.

Thank you!
Ashif Harji
2011-06-12 04:08:31 UTC
Permalink
Post by xewang
I have some questions regarding question 2.
1. How do I use the shell interface to run a program?
normally I type the following in the terminal
g++ xxx.cc
./a.out
for q2, it says that I should be able to type
include xxx.cc to ran it.
You are required to use the provided Makefile. It will produce an
executable named include. Depending on the setup of your PATH, for an
executable in the current directory, you will need to run either include
or ./include. If you are confused about Makefiles, please see one of the
course staff.
Post by xewang
Also if I want include to output to a file, would it be
include xxx.cc outfile.txt?
This command should output to the file outfile.txt.
Post by xewang
2. when I use this command on a simple file
cpp -P -C -traditional -cpp jane.cc
the output looks like this
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: warning: extra tokens at end of #include directive
jane.cc:1: error: iostream: No such file or directory
jane.cc:2: warning: extra tokens at end of #include directive
jane.cc:2: warning: extra tokens at end of #include directive
jane.cc:2: warning: extra tokens at end of #include directive
jane.cc:2: warning: extra tokens at end of #include directive
jane.cc:2: warning: extra tokens at end of #include directive
jane.cc:2: warning: extra tokens at end of #include directive
jane.cc:2: error: iomanip: No such file or directory
plus the all the code in jane.cc
Should my include also generate something like that?
Your include program is only responsible for include lines with a specific
format, i.e., filenames in double quotes. See my previous newsgroup post
for more details. Without seeing the contents of jane.cc, I cannot
comment on the expected output or if the content of jane.cc is valid input
for the assignment question. However, to find out the exact output
required for valid input, use the reference executable provided on the
assignments page.
Post by xewang
3. Also for the routine #include
do we defined it like this?
#define #include( ... ) ( ... )
I am not sure I understand this question. #include is actually a
preprocessor directive not a macro. Refer to the course notes for more
details.

ashif

Continue reading on narkive:
Loading...