Why doesn't the "Compile the current file" button work?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
Antipodal
Posts: 253
Joined: Thu 26 Mar 2009, 16:52
Location: The other side of the world

Why doesn't the "Compile the current file" button work?

#1 Post by Antipodal »

I have chosen to understand what programming is about using C++ because I have heard that - though it's not the easiest language to understand - once you have figured it out, it simplifies understanding other languages.
Following "Lesson 1" at http://en.wikiversity.org/wiki/C%2B%2B I have typed at my Slacko's Geany the following

Code: Select all

#include <iostream>
 
using namespace std;
 
int main()
{
   cout << "Hello World!" << endl;
   cin.get();
 
   return 0;
}
and I have tried to compile it there, but the "Compile the current file" button on Geany is not active and I don't understand why this occurs.
Could you please explain this for me?
Thank you
Posting from a P4 3Ghz_ASUS P5G41T-M LX3_2G RAM_DVD Write desktop with no internal HDD
Saving my stuff on flash sticks and in external USB HDD

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#2 Post by don570 »

I think that geany needs to be specially setup to compile.
Only the 'experts' do that.

First of all make sure that devx file is installed. For recent puppy distros
this is easy. Just download the devx file for your distro and click on it
and it will install automatically.


I'll check if the following example from your course is possible.
Puppy uses GCC
Each compiler has its own way of compiling programs. If you use GCC, type the following in a terminal:
c++ example.cpp -o example
___________________________________________

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#3 Post by sunburnt »

Geany can be set up to edit and run many different languages.

You can also select the syntax highlighting by doing this:

On the menubar select:
[ Document ] > [ Set Filetype ] > [ Programming Languages ] > [ C++ file ]

# Note: C isn`t the best way to start learning, it has a rather large learning curve.
A better start for a new comer is Bash scripting. Much easier to start learning.

All languages I`ve ever seen, all have the same methods: Branching, Looping, and Functions.
Each was designed for a purpose, and has a different method and syntax for doing things.
Bash is a good starter to learn the basics, as it will teach you these programming methods.
.

User avatar
puppyluvr
Posts: 3470
Joined: Sun 06 Jan 2008, 23:14
Location: Chickasha Oklahoma
Contact:

#4 Post by puppyluvr »

:D Hello,
Bash is the best tool to start off with in Linux.
You dont need the devx for it. You do to compile.
D/L the devx and enable it thru the bootmanager.
Test it. Open a terminal and enter
make
You should get a warning
"No makefile.found"
If you get
"Command not found"
It didnt work.
After you have it working the compile button in geany should work.
Close the Windows, and open your eyes, to a whole new world
I am Lead Dog of the
Puppy Linux Users Group on Facebook
Join us!

Puppy since 2.15CE...

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

Re: Why doesn't the "Compile the current file" button work?

#5 Post by Moose On The Loose »

Antipodal wrote:I have chosen to understand what programming is about using C++ because I have heard that - though it's not the easiest language to understand - once you have figured it out, it simplifies understanding other languages.
C++ is indeed hard to learn. Knowing its obscure workings does very little to teach you about programming. If you really want to learn to program (as opposed to code), you want something more like a PIC microcontroller in assembly and a project like finding the squareroot of a 32 bit number. It is easy to see if you got it right and requires you to actually learn to program to get it done. As a second option try this as a project:

tic-tac-toe is a very simple game but it does require you to do many of the things needed for programming. You can write one in bash in 100 lines of bash that plays with it taking the X and always winning if it can be done against your moves.

The nice thing about coding in bash instead of C++ is that you can do multithread programs etc without a lot of trouble with libraries.

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#6 Post by don570 »

I was able to get geany to work in Precise Puppy and Wheezy Puppy
by doing the following....

1 ) Load devx file
2 ) Save the geany text to /root as example.cpp
3 ) Select 'Build' from menu ---> this runs c++ example.cpp -o example
4 ) Select 'Execute' from menu and terminal will launch automatically
and Hello World will show.

_______________________________________

Antipodal
Posts: 253
Joined: Thu 26 Mar 2009, 16:52
Location: The other side of the world

Thanking everybody

#7 Post by Antipodal »

Thank you folks!
My delay in doing this is due to the shock I have suffered from the amount of things I have discovered since I read don570's first post and to the fact that I was left without my internet connection for at least 12 hours.

sunburnt's, puppyluvr's & Moose On The Loose's posts are also very welcome!

Thank you very much indeed!

I'm sure that after I have digested my discoveries and your experienced comments I will come back for some more.
:)

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

Re: Thanking everybody

#8 Post by Moose On The Loose »

Antipodal wrote:Thank you folks!
My delay in doing this is due to the shock I have suffered from the amount of things I have discovered since I read don570's first post and to the fact that I was left without my internet connection for at least 12 hours.

sunburnt's, puppyluvr's & Moose On The Loose's posts are also very welcome!

Thank you very much indeed!

I'm sure that after I have digested my discoveries and your experienced comments I will come back for some more.
:)
Also: I use DDD to make debugging a point and click matter. On rare occasions, even I make bugs in my programs.

It is in one of the ubuntu repos.

Post Reply