Author Topic: Day 0 Newbie:- Trying to get anything to work ! Help !  (Read 8795 times)

Offline timmoore46

  • Single posting newcomer
  • *
  • Posts: 7
Day 0 Newbie:- Trying to get anything to work ! Help !
« on: September 04, 2013, 04:30:16 pm »
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


Offline timmoore46

  • Single posting newcomer
  • *
  • Posts: 7
Re: Day 0 Newbie:- Trying to get anything to work ! Help !
« Reply #2 on: September 04, 2013, 07:20:52 pm »
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:
Code: [Select]
Paste full build log here.

Crash report:
Code: [Select]
Paste the contents of codeblocks.RPT here (if Code::Blocks crashed).

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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6951
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Day 0 Newbie:- Trying to get anything to work ! Help !
« Reply #4 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.

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

Offline timmoore46

  • Single posting newcomer
  • *
  • Posts: 7
Re: Day 0 Newbie:- Trying to get anything to work ! Help !
« Reply #5 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

Offline eoneuk

  • Multiple posting newcomer
  • *
  • Posts: 18
    • http://
Re: Day 0 Newbie:- Trying to get anything to work ! Help !
« Reply #6 on: September 05, 2013, 01:11:36 am »
change test.cpp to test.c

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Day 0 Newbie:- Trying to get anything to work ! Help !
« Reply #7 on: September 05, 2013, 06:28:00 am »
Errr.... do I understand the correctly that I HAVE to use C++ and I can't use GCC ?

A very very puzzled,

Tim
change test.cpp to test.c

You should learn to read more exactly:
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.3F
Remember the file extension matters: *.c is compiled as C file, *.cpp is compiled as C++ file. Read more

Offline timmoore46

  • Single posting newcomer
  • *
  • Posts: 7
Re: Day 0 Newbie:- Trying to get anything to work ! Help !
« Reply #8 on: September 05, 2013, 08:50:07 am »
 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.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




Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Day 0 Newbie:- Trying to get anything to work ! Help !
« Reply #9 on: September 05, 2013, 08:54:22 am »
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++ .

Offline timmoore46

  • Single posting newcomer
  • *
  • Posts: 7
Re: Day 0 Newbie:- Trying to get anything to work ! Help !
« Reply #10 on: September 05, 2013, 10:37:09 am »
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
« Last Edit: September 05, 2013, 11:35:09 am by timmoore46 »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2763
Re: Day 0 Newbie:- Trying to get anything to work ! Help !
« Reply #11 on: September 05, 2013, 11:58:24 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

Offline timmoore46

  • Single posting newcomer
  • *
  • Posts: 7
Re: Day 0 Newbie:- Trying to get anything to work ! Help !
« Reply #12 on: September 05, 2013, 12:07:54 pm »
(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

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2763
Re: Day 0 Newbie:- Trying to get anything to work ! Help !
« Reply #13 on: September 05, 2013, 12:13:27 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

Offline timmoore46

  • Single posting newcomer
  • *
  • Posts: 7
Re: Day 0 Newbie:- Trying to get anything to work ! Help !
« Reply #14 on: September 05, 2013, 12:55:12 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