C++ newbie question in Mint

Questions about applications and software
Forum rules
Before you post please read how to get help

C++ newbie question in Mint

Postby spas87 on Fri May 30, 2008 7:13 am

When make some simple programs in c++ and compile them after that in .exe expresion they work only in terminal by typing ./example.exe, if i try to open them when browsing files it wont work what expression to give them to work by double clicking on them thanks in advance for the help
Image
spas87
Level 2
Level 2
 
Posts: 73
Joined: Tue Mar 18, 2008 10:21 am

Linux Mint is funded by ads and donations.
 

Re: C++ newbie question in Mint

Postby Husse on Fri May 30, 2008 7:20 am

exe files are Windows
Do you ask about the file extension?
None in Linux most (but not all) files have no extension
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19703
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: C++ newbie question in Mint

Postby ed@Mint on Fri May 30, 2008 7:23 am

Why do you give your executables and exe extension ?
That wont make them work in windows anyway..
In Linux, executables have usually no extension, so if you have for example a source file named 'foo.cpp', just name the binary 'foo'

But an .exe extension should not prevent the file to be executed... Just make sure that the permissions of your file are set to 'rwx' i.e. make them executable :wink:
In libro veritas

Now switched to : ArchLinux

New users, read the Linux Mint User Guide | Problem ? See the Wiki first | Check out the Software Portal | Join the IRC channel : #linuxmint @ irc.spotchat.org
User avatar
ed@Mint
Level 5
Level 5
 
Posts: 565
Joined: Sun Mar 09, 2008 6:03 pm
Location: Liege, Belgium

Re: C++ newbie question in Mint

Postby Husse on Fri May 30, 2008 7:29 am

permissions of your file are set to 'rwx

Why did I forget that
Funny avatar ed@Mint :)
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19703
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: C++ newbie question in Mint

Postby ed@Mint on Fri May 30, 2008 7:53 am

Husse wrote:Funny avatar ed@Mint :)

Thanks :)
In libro veritas

Now switched to : ArchLinux

New users, read the Linux Mint User Guide | Problem ? See the Wiki first | Check out the Software Portal | Join the IRC channel : #linuxmint @ irc.spotchat.org
User avatar
ed@Mint
Level 5
Level 5
 
Posts: 565
Joined: Sun Mar 09, 2008 6:03 pm
Location: Liege, Belgium

Re: C++ newbie question in Mint

Postby spas87 on Fri May 30, 2008 8:00 am

ed@Mint wrote:Why do you give your executables and exe extension ?
That wont make them work in windows anyway..
In Linux, executables have usually no extension, so if you have for example a source file named 'foo.cpp', just name the binary 'foo'

But an .exe extension should not prevent the file to be executed... Just make sure that the permissions of your file are set to 'rwx' i.e. make them executable :wink:


Because didn't know what to put they work in console when i type ./exaple.exe thats what I'm asking whit what extension to make them to work by double clicking on them in Linux Mint i know that wont work in windows (can easily do that by compiling example.cpp files in windows command prompt :-) )
what a rwx mean cant make them run by double clicking from properties i have selected allow files to be executed as programs but still nothing working only by ./fileName in console


ops got that i dont need extension still not opening them (except in console whit ./filename)
Image
spas87
Level 2
Level 2
 
Posts: 73
Joined: Tue Mar 18, 2008 10:21 am

Re: C++ newbie question in Mint

Postby spas87 on Fri May 30, 2008 8:06 am

probably changing permissions in console i suppose any help newbie in command line entries any example please :-)thanks for the tips :-)
Image
spas87
Level 2
Level 2
 
Posts: 73
Joined: Tue Mar 18, 2008 10:21 am

Re: C++ newbie question in Mint

Postby ed@Mint on Fri May 30, 2008 8:28 am

To be honest i didn't understand a word to your previous post, please take your time for writing.

The command you're asking for is
Code: Select all
chmod 0755 <file>
or
Code: Select all
chmod +x <file>

try these two if you want to know the difference.

Now on a more general aspect, i see you are starting to program stuff.
It is now time for you to stop relying on the GUIs, the terminal is the programmer's friend.
Moreover, if those are basic C++ programs like you said above, they are certainly not graphical, so why launch it from a GUI ?
In libro veritas

Now switched to : ArchLinux

New users, read the Linux Mint User Guide | Problem ? See the Wiki first | Check out the Software Portal | Join the IRC channel : #linuxmint @ irc.spotchat.org
User avatar
ed@Mint
Level 5
Level 5
 
Posts: 565
Joined: Sun Mar 09, 2008 6:03 pm
Location: Liege, Belgium

Re: C++ newbie question in Mint

Postby spas87 on Fri May 30, 2008 8:42 am

yes i know that there is no point for now but want to know hot to make it and thanks a lot for the help and i know that terminal i needed but im still learning command lines in it is one of the things which im looking now but the list is big :-)
1.c++
2.learning to use and adjust linux
3(x)html, mysql, php
4.playing with apache server
5. collage work and social life and I'm a bit tight on time for all that :-)

thanks again for the help will try the suggestions now
Image
spas87
Level 2
Level 2
 
Posts: 73
Joined: Tue Mar 18, 2008 10:21 am

Re: C++ newbie question in Mint

Postby rbanavara on Sun Jun 08, 2008 3:45 pm

1. C++ : long time back when I read about C/C++ on linux, it used to create a file called a.out by default when compiled (which is the equivalent of .exe file in DOS world). This could then be executed by ./a.out (by default it had execute permission I beleive). This all from command prompt.

Tried to simulate clicking the a.out from file browser (nautilus), but I could not compile my Hello World prograam (failed with: test.c:1:19: error: stdio.h: No such file or directory) :? So I tried clicking ls command from bin directory and sure nothing happens if double clicked in file browser for a command that terminal oriented.

If it helps, you may try out the IDE like anjuta (not sure if the spelling is correct!) might be good for you. Its a GUI frontend like turboC / borland C on windows.

2. Learning Linux : There should be some tutorial on the net that could help you. But these days, you can manage 75% of your tasks with GUI.

on html / Java / php / mySQL probably you just have to start working with it...!
Don't fix it if it ain't broken, don't break it if you can't fix it -Husse
User avatar
rbanavara
Level 4
Level 4
 
Posts: 233
Joined: Mon Jun 02, 2008 9:07 am

Re: C++ newbie question in Mint

Postby ed@Mint on Sun Jun 08, 2008 5:57 pm

.out is not the "equivalent" of .exe
In UNIX systems, any file can have any extension, but we stick to some to help file browsers identify them and launch the appropriate program.
Executable files don't have extension, have a look in /usr/bin to convince yourself.

GUIs are a bad idea when you want to program.
The best example is that when you have problems with a particular program, you are often asked you launch it from the console so that you can see the error messages.
To understand what you do, use the CLI.
Then, if you eventually come to *big* projects, a GUI IDE might be of some help.
(you'll understand that i don't include editors like gedit and kate in the "GUI" category though they are, but you sure can use vim :wink: )
In libro veritas

Now switched to : ArchLinux

New users, read the Linux Mint User Guide | Problem ? See the Wiki first | Check out the Software Portal | Join the IRC channel : #linuxmint @ irc.spotchat.org
User avatar
ed@Mint
Level 5
Level 5
 
Posts: 565
Joined: Sun Mar 09, 2008 6:03 pm
Location: Liege, Belgium

Re: C++ newbie question in Mint

Postby rbanavara on Mon Jun 09, 2008 2:46 am

What I beleive is CLI is more for geeks & GUI is for the rest (rather could include geeks as well!). As per the quote in "Brief History of Time", an equation scares off half of your readers. and probably so does CLI (and for this, I like the apple's approach). If spas87 is interested in C++ Programming, he just be able to do that. Probably as he gets used to linux, he can venture in to CLI.

It all depends on what spas87 is interested in... understanding linux & programming C++ or just programming C++ on linux.
Don't fix it if it ain't broken, don't break it if you can't fix it -Husse
User avatar
rbanavara
Level 4
Level 4
 
Posts: 233
Joined: Mon Jun 02, 2008 9:07 am

Re: C++ newbie question in Mint

Postby spas87 on Fri Jun 13, 2008 4:02 am

rbanavara wrote:What I beleive is CLI is more for geeks & GUI is for the rest (rather could include geeks as well!). As per the quote in "Brief History of Time", an equation scares off half of your readers. and probably so does CLI (and for this, I like the apple's approach). If spas87 is interested in C++ Programming, he just be able to do that. Probably as he gets used to linux, he can venture in to CLI.

It all depends on what spas87 is interested in... understanding linux & programming C++ or just programming C++ on linux.


Well understanding linux & programming C++ but any way I don't need GUI yet I just started and the programs which I write are all executed in console the only thing that I have problem is that cant open a file on double click but actualy I dont need that because I execute them in console by ./and_the_name_of_my_file
and it is not a effort because I'm in that directory anyway to compile the programs which I'm testing probably I will use GUI later on but I don't think I need it for now and I use Microsoft Visual Basic a bit a at Collage anyway but want to learn C++.
Image
spas87
Level 2
Level 2
 
Posts: 73
Joined: Tue Mar 18, 2008 10:21 am

Linux Mint is funded by ads and donations.
 

Return to Software & Applications

Who is online

Users browsing this forum: Google Adsense [Bot], karlchen and 26 guests