SOLVED: "Hello World!" - So, what next...?

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

SOLVED: "Hello World!" - So, what next...?

Postby alloydog » Wed Jun 21, 2006 4:03 am

For some reason KDevelop wouldn't compile the "Hello World!" script, so while I get around to fixing it, I installed Xwpe.

I wrote the obligatory "Hello world" script, and in Xwpe, it compiled OK and ran OK.

Now... the last time I tried learning C++, I used a give-away copy of Borland's C++ Builder/TurboC++ version 1 (hence the familiarity with Xwpe) under Windows 98 and NT.

When I complied the script, I got a nice executable file helloworld.exe.

Now I'm using this Linuxy thing, I get helloworld.o and helloworld.e.

I thought the Unix/Linux equivilent of the .exe was a .bin file?
What do I need to get Hello World to print out at the command line, as it would under DOS with the executable?

----edit------
Solved!

Code: Select all
# helloworld.e
# Hello World!
#


simple really :oops:
User avatar
alloydog
LXF regular
 
Posts: 600
Joined: Thu Apr 07, 2005 7:32 pm

Postby penguintutor » Wed Jun 21, 2006 3:12 pm

I am not familiar with Xwpe, which appears to have discontinued development, and is lacking in documentation. Here is some generic info that might help.

On unix the file extension is not used to determine whether something is executable or not. Instead the first few bytes of the file are examined to see if it is a program. So the extension doesn't matter. For some formats the normal conventions are used, but for executables normally they are created without any extension so that you just run using the name of the command (without needing to add .exe or .bin on the end).

The .o file is an object file, but I'm not sure about a .e file.
you can see if the operating system recognises the file using:
Code: Select all
file helloworld.e

which may give an idea of what the file is.

Has the program been linked? Without documentation I don't know how that is done, maybe it works with the standard linker?

If it has actually created a binary executable, then you may just need to change it's permissions

Code: Select all
chmod u+x [i]filename[/i]
User avatar
penguintutor
 
Posts: 16
Joined: Mon Jun 05, 2006 1:41 pm
Location: UK

Postby alloydog » Wed Jun 21, 2006 4:28 pm

just typing helloworld.e at the command line worked fine. The problem was between the chair and the keyboard...

I was expecting helloworld.bin, so was 'confused' a bit by the .e extention.

I didn't know about the file command though.
Code: Select all
# file helloworld.e
helloworld.e: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), not stripped

Interesting bit: 32-bit LSB executable, Intel 80386 - I thought the 386 was 16-bit?
User avatar
alloydog
LXF regular
 
Posts: 600
Joined: Thu Apr 07, 2005 7:32 pm

Postby penguintutor » Wed Jun 21, 2006 4:48 pm

The 80386 was a full 32 bit processor, which became known as the 80386DX when the SX was released.

The 80386SX was internally a 32 bit processor, but had only a 16bit external bus.
User avatar
penguintutor
 
Posts: 16
Joined: Mon Jun 05, 2006 1:41 pm
Location: UK

Postby GMorgan » Wed Jun 21, 2006 6:47 pm

With Kdevelop what do you mean it didn't compile. Do you mean there was no compile option or that it did have a compile option but it didn't work. To get Kdevelop to work properly you need to create a project. Create a simple hello world C++ project and you can then compile via the three buttons above the text editor and at the leftmost corner.

If you are seriously having problems with it post the console output and we can try and fix it.
GMorgan
LXF regular
 
Posts: 684
Joined: Thu Jan 12, 2006 6:58 pm
Location: South Wales, UK

Postby alloydog » Wed Jun 21, 2006 7:57 pm

Thanks, I'm checking that out now.
User avatar
alloydog
LXF regular
 
Posts: 600
Joined: Thu Apr 07, 2005 7:32 pm

Postby alloydog » Thu Jun 22, 2006 7:44 pm

Kdevelope works fine - once you start a new project...

well which methed should I use?

GEdit + command line compiling => walking
Xwpe => riding a bicycle
KDevelope => fully equipped motorhome, including the kitchen sink...

:)
User avatar
alloydog
LXF regular
 
Posts: 600
Joined: Thu Apr 07, 2005 7:32 pm

Postby GMorgan » Fri Jun 23, 2006 9:01 am

I like Kdevelop since it can be used for every language under the sun. If in future you decide to learn a scripting language like Python and combine it with C++ (i.e. C++ for the backend and Python for the GUI for quick interface turnover) it can be done using the same tool. Not to mention that its plugin architecture allows you to run things like QT Designer within the project and even import QT UI files directly into a C++ project.
GMorgan
LXF regular
 
Posts: 684
Joined: Thu Jan 12, 2006 6:58 pm
Location: South Wales, UK


Return to Programming

Who is online

Users browsing this forum: Exabot [Bot] and 0 guests