Results 1 to 5 of 5
Just for fun I decided to port a very minimal Windows/MS shell application of mine to Linux (shell only installation).
I ran aptitude and after a while I had g++-3.4 ...
- 07-03-2007 #1Just Joined!
- Join Date
- Jan 2007
- Posts
- 13
WTF!!! Compile/Link & Run, how hard can it be?
Just for fun I decided to port a very minimal Windows/MS shell application of mine to Linux (shell only installation).
I ran aptitude and after a while I had g++-3.4 installed.
I copied my single cpp file to my home dir and ran:
# g++-3.4 Myfile.cpp
and after a cleaning up a few issues I suddenly got an a.out.
Happy as ever I now typed
# a.out
but then get a "command not found". Huh, what's this?
Typing
# a TAB, nothing happens
# a. TAB, nothing happens.
Seems like system doesn't accept my file as an executable even though file flags are set to x. Where did I go wrong? Shouldn't an executable be runnable this way?
- 07-03-2007 #2Code:
chmod x a.out
free/libre/open software for the people by the people
Linux user #185360
- 07-03-2007 #3Just Joined!
- Join Date
- Jan 2007
- Posts
- 13
x flag is already set for ogu by compiler/linker.
- 07-03-2007 #4
try ./a.out
when you enter just a.out, it searches through /bin and /sbin and the like looking for the file. typing the ./ is like saying 'hey, look for the program in the directory im in'
PS: if you dont want the output of the compiler to save to a.out, you can try specifying the desired filename with the -o (lowercase letter o)
ex gcc -o myprogram myprogram.cppLiving the digital dream....
Disclaimer: I may be wrong since I was once before.
Breathe out so I can breathe you in ~~Everlong
- 07-03-2007 #5Just Joined!
- Join Date
- Jan 2007
- Posts
- 13
Ah, thanks!
Should have thought of that, still to used to how windows apply search paths I guess...
The code snippet works like a charm so now I just have to polish it a bit and figure out how to execute it periodically (it's for retreiving data once a day from a web server). Maybe it would have been easier to do this with a script language but I'm to used to C...


Reply With Quote
