I am just beginning with Unix..and am missing something obvious. I want to show the g++ compands to compile, then link into an executable a program with two cpp source files. Call the executable program mygrog. Incude the option to display warning messages. This is what I have..Is this correct? How do I call the executable program?
G++ -Wall –o myprog source1.cpp source2.cpp
REALLY simple Unix problem?
Yeah, that looks right to me (though you probably meant g++ instead of G++)
If that command completes, you should see a "myprog" file in the directory in which you ran that command. You should be able to invoke that command by typing "./myprog".
You may need to double check to see if the myprog file has its executable bit set...so if you type "ls -l"and you see something like this:
-rw-rw-r-- .....stuff.... myprog
Then there's no executable bit (you're looking for an "x" in the 4th spot of the '-rw-rw-r--' line). So you can set an executable bit by typing "chmod u+x myprog" and then try running it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment