News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Day 0 Newbie:- Trying to get anything to work ! Help !

Started by timmoore46, September 04, 2013, 04:30:16 PM

Previous topic - Next topic

timmoore46

Just downloaded it and typed into the editor 'Hello World' program.

It failed !  I'm using GCC in Linux  and it wanted G++

How do I fix that ?

I'm very new to 'C' and this is first attempt using a book called 'C programmimg for Absolute Beginners'  Que,  they said use Code::Blocks, so here I am.

Any thoughts very welcome.

A puzzled,

Tim


timmoore46

I am running Code::Blocks 10.05   64 bit :BlocksVersionNumber on MyOperatingSystem Linux
(version Ubunti ). The compiler I use is GCC


When I ...load

/* Print message to screen  */

#include <stdio.h>

main()

{
        printf("Just a test of Hello World");
        reurn 0;

}




Description of problem.
this message arrives:-


-------------- Build: default in Hello ---------------

Compiling: test.cpp
/bin/sh: 1: g++: not found
Process terminated with status 127 (0 minutes, 0 seconds)
0 errors, 0 warnings



Build log:

Paste full build log here.


Crash report:

Paste the contents of codeblocks.RPT here (if Code::Blocks crashed).


Not sure what to do !!!  :  (((
 

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Jenna

This should lead you in the right direction:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
especially the last line.

And please use code-tags, if you post code or log-text (the hash
  • button).

timmoore46

Errr.... do I understand the correctly that I HAVE to use C++ and I can't use GCC ?

A very very puzzled,

Tim

eoneuk


Jenna

Quote from: timmoore46 on September 05, 2013, 12:05:23 AM
Errr.... do I understand the correctly that I HAVE to use C++ and I can't use GCC ?

A very very puzzled,

Tim
Quote from: eoneuk on September 05, 2013, 01:11:36 AM
change test.cpp to test.c

You should learn to read more exactly:
Quote from: jens on September 04, 2013, 08:14:51 PM
This should lead you in the right direction:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
especially the last line.

This is the last line:
Quote from: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3FRemember the file extension matters: *.c is compiled as C file, *.cpp is compiled as C++ file. Read more

timmoore46

 Quote/Q: How can I change the language of the compiler (gcc) output to english?

A: Codeblocks 12.11 or higher: Settings->Environment->Environment Variables. Add "LC_ALL" with value "C". ->Set Now -> Ok

Since a few releases gcc is localized. This can make difficult to find (google ;) ) solutions for specific problems. With this setting the output is again in english.

!! this can break displaying of non-aschii characters so you can also use LC_ALL = en_US.utf8 (http://forums.next.codeblocks.org/index.php/topic,17579.msg120613.html#msg120613)
/end of Quote

I'm using 10.05 because that is what Linux Ubuntu 12.04 was prepared to download and install.   Candidly  I don't think this early version supports GCC.

Error message was:-

Compiling: /home/tim/0My Everything/My C/hello.c
Linking console executable: /home/tim/0My Everything/My C/hello
/bin/sh: 1: g++: not found
Process terminated with status 127 (0 minutes, 0 seconds)
0 errors, 0 warnings

____________

Now I can run this program 'hello.c' from Bash no probs.

Unfortunately I've not understood 95% of the replys, but I did understand changing the extension to ".c"

I think I'll return to Bash as something is 'not fully cooked', maybe its me, maybe its 10.05 of C::B,  I'm just puzzled such a simple thing as running 'hello world' is seemingly impossible from this IDE on my version of Linux.

:  (

Tim




Jenna

If you want to use c++ (g++ is the executable of gcc's c++-compiler), you have to install the appropriate package explicitely with your favourite package-manager.

On Debian based systems (like Ubuntu) it should be enough to run sudo apt-get install g++ .

timmoore46

#10
Many thanks !  G++ installed a treat !

I have now installed C::B  v 12.11 on a diiderent computer running Ubuntu 13.04  and its seems a lot more friendly.

However I can't seem to copy the code from the Editors window or the 'Logs and others'
 So can't easily post what I've achieved.

log hand the source is:

#include <stdio.h>

int main()
{
       printf(Hello world!\n");
       return 0;
}

and the 'Logs and others'

---Build: R0.01 in Test01 (compiler:- GNU GCC Compiler)----

Linking stage skipped (build target has no object files to link)
Nothing to be done (all items are up-to-date).

______

Which is a big improvement  *~LOL*~ But as I'm falling down every hole, I've missed something obvious...

Update:-   It now compiles fine after G++ was installed.  and produces a ./hello executable also a '.o' file.

(still find it weird that it only worked on G++ and GCC was ignored)

Many thanks for your very patient support !

:  )))

Tim

BlueHazzard

Quote from: timmoore46 on September 05, 2013, 10:37:09 AM
(still find it weird that it only worked on G++ and GCC was ignored)

gcc is the "GNU Compiler Collection". g++ is a part of gcc. The "gcc" executable is the c compiler, the g++ is the c++-compiler.
If your file ends with cpp then you use the c++ compiler, so you need the g++ executable.
If your file ends with c then you are using the c compiler and you need the gcc executable.

greetings

timmoore46

Quote from: BlueHazzard on September 05, 2013, 11:58:24 AM
Quote from: timmoore46 on September 05, 2013, 10:37:09 AM
(still find it weird that it only worked on G++ and GCC was ignored)

gcc is the "GNU Compiler Collection". g++ is a part of gcc. The "gcc" executable is the c compiler, the g++ is the c++-compiler.
If your file ends with cpp then you use the c++ compiler, so you need the g++ executable.
If your file ends with c then you are using the c compiler and you need the gcc executable.

greetings

You have put your finger on the problem.   Running CB  10.05 on my Linux box  GCC works fine under bash but under CB IDE a something.c source file get an error message and does not compile.  CDb 12.11 behaves differently.

Many thanks for responding.   How do you get on with CB's Editor ? can you cut and paste into it ok ?

: )))

Tim

BlueHazzard

Quote from: timmoore46 on September 05, 2013, 12:07:54 PM
can you cut and paste into it ok ?

Can't you c&p in your Editor, or only in the log window? Does it work with right-click -> Edit -> cut ?
In the log window ctrl+c isn't working (as i remember) but in the editor it should work. If not, you may have trouble with the short-cuts. you can search the forum to resolve the error, i think this was reported many times...

greetings

timmoore46

Quote from: BlueHazzard on September 05, 2013, 12:13:27 PM
Quote from: timmoore46 on September 05, 2013, 12:07:54 PM
can you cut and paste into it ok ?

Can't you c&p in your Editor, or only in the log window? Does it work with right-click -> Edit -> cut ?
In the log window ctrl+c isn't working (as i remember) but in the editor it should work. If not, you may have trouble with the short-cuts. you can search the forum to resolve the error, i think this was reported many times...

greetings

The Edit> cut paste works fine !   Many many many thanks !

On the Log report thing on I think there might be an option that works.  I'll get back on that one.

:  )))

Tim