Geany Problem

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Josh138

Geany Problem

Post by Josh138 »

Exit code 127: Something wrong with the machine?
That was what I got on my search for why my Hello World program didn't run. My code matches everyone else's on the examples. Anyone else had this problem on Geany?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Josh138

Re: Geany Problem

Post by Josh138 »

I think I found my problem but I'm not sure how to fix it. Do I need a newer version of GTK+ than what Mint comes with?
dagon
Level 7
Level 7
Posts: 1655
Joined: Mon Dec 06, 2010 4:33 am
Location: Kungälv, Sweden
Contact:

Re: Geany Problem

Post by dagon »

Josh138 wrote:Exit code 127: Something wrong with the machine?
You must provide more information. Is it a c project or C++ or something else?
My code matches everyone else's on the examples.
Please link to the code or paste it in here.
Anyone else had this problem on Geany?
You are compiling sourcecode. When you compile you get errors. Allmost all the time...
richyrich

Re: Geany Problem

Post by richyrich »

Hi Josh,
Yea, also, we sorta need to know what version & flavour of Mint you are running, what version of Geany, and what version of GTK it is requesting ?
And of course the standard/always asked question; do you have build-essentials installed ?
richy
Josh138

Re: Geany Problem

Post by Josh138 »

Sorry I am a little new to Linux so I just kind of assume that everyone is running the same OS lol. I am running Linux Mint 10 (Julia) and all I have done is install the latest patches. ) 0.20 Geany and it requests a 2.8 or higher GTK but I am not sure how to check what I have or understand the update manual becuase I'm not sure if I should update or doing a fresh instal of GTK+. This may sound really stupid but I'm not exactly sure what biuld-essentials are. I've only had one programming class and it used Visual Studio 10 with C++. Thank you for your time.

I am trying to do the C++ "Hello World" with

#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World";
return 0;
}
dagon
Level 7
Level 7
Posts: 1655
Joined: Mon Dec 06, 2010 4:33 am
Location: Kungälv, Sweden
Contact:

Re: Geany Problem

Post by dagon »

Josh138 wrote:t I'm not exactly sure what biuld-essentials are.
http://forums.linuxmint.com/viewtopic.php?f=90&t=9234

I don't you need it for this example though. When you compile something like "gnome" from source you need build-essentials and more...
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World";
return 0;
}
I just compiled it from the command line and it works fine. I also got error 127 in geany though. I don't remember how geany works but
in my case right now it compiled just fine but couldn't execute the program because it only made me an object file.
That's the compiled code that hasn't gone through the final fase called linking.
For this exercise you can skip geany and do it from the commandline instead. Like a real pirate.

1. Save the file and give it a name ending with cpp or cxx.
2.

Code: Select all

g++ hello.cpp
The default name of the executable out from the compiler is "a.out"
To run a.out:

Code: Select all

./a.out
I'll try and look into geany later but I don't have time right now.
Good luck... :)
dagon
Level 7
Level 7
Posts: 1655
Joined: Mon Dec 06, 2010 4:33 am
Location: Kungälv, Sweden
Contact:

Re: Geany Problem

Post by dagon »

Ok. You need to press F9 to build (compile, link... whatever!) and F5 to run the executable in a terminal. You probably pressed F8 for compile no?
Josh138

Re: Geany Problem

Post by Josh138 »

I just hit the biuld on the menu and that's what I got. When I tried doing it from the terminal I got this:

josh@fatman2 ~ $ g++ HelloWorld.ccp
HelloWorld.ccp: file not recognized: File format not recognized
collect2: ld returned 1 exit status
josh@fatman2 ~ $
dagon
Level 7
Level 7
Posts: 1655
Joined: Mon Dec 06, 2010 4:33 am
Location: Kungälv, Sweden
Contact:

Re: Geany Problem

Post by dagon »

josh@fatman2 ~ $ g++ HelloWorld.ccp
.ccp -> .cpp
Josh138

Re: Geany Problem

Post by Josh138 »

After I installed build essentials and tried it both ways:

josh@fatman2 ~ $ g++ HelloWorld.cpp
g++: HelloWorld.cpp: No such file or directory
g++: no input files
josh@fatman2 ~ $ ./a.out
bash: ./a.out: No such file or directory
josh@fatman2 ~ $

In Geany
make (in directory: /home/josh/Desktop)
make: *** No targets specified and no makefile found. Stop.
Compilation failed.
dagon
Level 7
Level 7
Posts: 1655
Joined: Mon Dec 06, 2010 4:33 am
Location: Kungälv, Sweden
Contact:

Re: Geany Problem

Post by dagon »

Ok. If you're in Home go:

Code: Select all

g++ ~/HelloWorld.cpp
dagon
Level 7
Level 7
Posts: 1655
Joined: Mon Dec 06, 2010 4:33 am
Location: Kungälv, Sweden
Contact:

Re: Geany Problem

Post by dagon »

Sorry, I read it through once more.
Josh138 wrote: josh@fatman2 ~ $ g++ HelloWorld.cpp
g++: HelloWorld.cpp: No such file or directory
g++: no input files
josh@fatman2 ~ $ ./a.out
bash: ./a.out: No such file or directory
josh@fatman2 ~ $
I wan't to see your related files in Home:

Code: Select all

cd;ls -l HelloWorld*
In Geany
make (in directory: /home/josh/Desktop)
make: *** No targets specified and no makefile found. Stop.
Compilation failed.
The compiler is telling you that you don't have a makefile. You really don't. Pressing <shift> F9 does that on my Geany and
gives me the same message.
Under:

Code: Select all

Build > Set Build Commands
The label "build" has this code on my setup:

Code: Select all

g++ -Wall -o "%e" "%f"
Josh138

Re: Geany Problem

Post by Josh138 »

When I compile I get this in Geany:

g++ -Wall -c "HelloWorld.ccp" (in directory: /home/josh/Desktop)
Compilation finished successfully.
g++: HelloWorld.ccp: linker input file unused because linking not done

When I biuld I get this:
g++ -Wall -o "HelloWorld" "HelloWorld.ccp" (in directory: /home/josh/Desktop)
Compilation failed.
HelloWorld.ccp: file not recognized: File format not recognized
collect2: ld returned 1 exit status
Josh138

Re: Geany Problem

Post by Josh138 »

josh@fatman2 ~ $ cd;ls -l HelloWorld*
-rw-r--r-- 1 josh josh 96 2011-05-06 05:11 HelloWorld.ccp
josh@fatman2 ~ $

Is what it gave me.
dagon
Level 7
Level 7
Posts: 1655
Joined: Mon Dec 06, 2010 4:33 am
Location: Kungälv, Sweden
Contact:

Re: Geany Problem

Post by dagon »

dagon wrote:
josh@fatman2 ~ $ g++ HelloWorld.ccp
.ccp -> .cpp
From my earlier post. Please check the spelling on the file endings. It's still wrong.
In the unix/linux world you mostly don't care about file endlings. When you compile something, suddenly you do.

Here is a link to a bookpage that describes the case. The example is in plain old c though...
http://www.network-theory.co.uk/docs/gc ... ro_95.html
Josh138

Re: Geany Problem

Post by Josh138 »

josh@fatman2 ~ $ g++ HelloWorld.cpp
g++: HelloWorld.cpp: No such file or directory
g++: no input files
josh@fatman2 ~ $

Even after I have I have changed the name to cpp in the file and resaved it as a cpp.
Last edited by Josh138 on Wed May 11, 2011 9:47 pm, edited 1 time in total.
dagon
Level 7
Level 7
Posts: 1655
Joined: Mon Dec 06, 2010 4:33 am
Location: Kungälv, Sweden
Contact:

Re: Geany Problem

Post by dagon »

Josh138 wrote:josh@fatman2 ~ $ g++ HelloWorld.cpp
g++: HelloWorld.cpp: No such file or directory
g++: no input files
josh@fatman2 ~ $
...because:
Josh138 wrote:josh@fatman2 ~ $ cd;ls -l HelloWorld*
-rw-r--r-- 1 josh josh 96 2011-05-06 05:11 HelloWorld.ccp
josh@fatman2 ~ $
solution:

Code: Select all

mv HelloWorld.ccp HelloWorld.cpp
Josh138

Re: Geany Problem

Post by Josh138 »

Thank you dagon! Switching it in the properties didn't change it but that did! I got it to run in the terminal and Geany!!!!!! Thank you so much I understand my mistake I just wasn't sure because I've never done anything like that while using Visual Studio 08 or 10. Oops :)
dagon
Level 7
Level 7
Posts: 1655
Joined: Mon Dec 06, 2010 4:33 am
Location: Kungälv, Sweden
Contact:

Re: Geany Problem

Post by dagon »

Yes. I've found programming rather easy but keeping track of the software you use to aid you is one of the biggest challenges, at least for me.
The link above to the on-line book on the gcc compiler is a good place to start. I recommend it warmly.

8)
Locked

Return to “Software & Applications”