Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: rickb on April 19, 2020, 11:00:13 pm

Title: Simple C Code Will Not Build
Post by: rickb on April 19, 2020, 11:00:13 pm
I cannot build a simple C program using:  Code::Blocks 13.12 on Mac OS X 10.7.5.  I know this is a legacy Mac, but it is all I've got for now.  My instructor recommends using the LLVM Clang compiler which I selected during setup.  When I build the standard "Hello World" or "Welcome to C programming" code, an object file is created but "/bin/sh: clang++ command not found" shows at bottom of the build log.  The Build messages show "Build failed: 0 error(s), 0 warning(s), (0 minute(s), 0 second(s)).
The attachment shows the Toolchain executables. 
Title: Re: Simple C Code Will Not Build
Post by: stahta01 on April 19, 2020, 11:14:43 pm
The directions say to leave off the bin folder!
Please remove the bin from end of the path; does it work then?

Tim S.
Title: Re: Simple C Code Will Not Build
Post by: rickb on April 19, 2020, 11:35:40 pm
No, I get the same messages.  Thanks for replying.
Title: Re: Simple C Code Will Not Build
Post by: stahta01 on April 19, 2020, 11:56:06 pm
Did you install the Clang compiler?

Tim S.
Title: Re: Simple C Code Will Not Build
Post by: rickb on April 20, 2020, 07:23:54 pm
I did a find in Terminal and found clang-cc in /Developer/usr/libexec.  I believe that's the clang compiler.

Thanks again for replying.
Title: Re: Simple C Code Will Not Build
Post by: stahta01 on April 20, 2020, 08:13:17 pm
I did a find in Terminal and found clang-cc in /Developer/usr/libexec.  I believe that's the clang compiler.

Thanks again for replying.

No it is not!

Clang compiler is normally "Clang" or "clang"; but it is not "clang-cc".
Edit2: The sub-folder libexec normally contains things that support the GCC or maybe other compilers.

Edit: Look inside of "/Developer/usr" do not look in a sub folder unless you think the path you told Code::Blocks is incorrect! And, if you think it is wrong correct it!

Tim S.
Title: Re: Simple C Code Will Not Build
Post by: stahta01 on April 20, 2020, 08:19:51 pm
Does the Clang compiler you installed. Install itself as a different command name?

Edit: Google implies the name "llvm+clang" might be used on the 1.0 version of clang.
Edit2: It might be called "llvm-gcc".

Tim S.
Title: Re: Simple C Code Will Not Build
Post by: oBFusCATed on April 20, 2020, 08:37:25 pm
@stahta01: Stop speculating, please... llvm-gcc is something else...

The compilers are named clang and clang++ if they are installed they are available in path.

@rickb Does autodetect fails to work? Do you have xcode installed? Have you run clang at least ones from the command line? If you haven't it will fail, because you have to accept the license.
Title: Re: Simple C Code Will Not Build
Post by: stahta01 on April 20, 2020, 08:42:26 pm
Since the poster would not say he installed a CLang compiler it is all speculation.

Tim S.
Title: Re: Simple C Code Will Not Build
Post by: rickb on April 21, 2020, 02:09:56 pm
@oBFusCATed Autodetect did work (see attachment).  Yes, I installed Xcode.  No, I didn't run clang from the command line (yet).

@stahta01 I did not install clang separately because I thought it came bundled either with Xcode or some other package.

Please bear with me.  I haven't written a C program since 1995 with Borland TurboC for DOS.

Thank you.
Title: Re: Simple C Code Will Not Build
Post by: oBFusCATed on April 21, 2020, 07:45:57 pm
OK, does compiling work now?
Title: Re: Simple C Code Will Not Build
Post by: rickb on April 22, 2020, 11:54:26 am
No, I'm afraid not.  Please see the attachment showing the Build Log.  The directory /bin/sh does not exist when I try to find it in a Terminal window.  This is where I'm stuck.

Thanks for replying.  Any help would be appreciated.
Title: Re: Simple C Code Will Not Build
Post by: oBFusCATed on April 22, 2020, 07:20:15 pm
It is telling you that clang++ doesn't exists.
Have you tried running clang++ from a terminal? Does it work?
Title: Re: Simple C Code Will Not Build
Post by: rickb on April 22, 2020, 09:25:45 pm
You're right.  I could not find clang++ in a terminal window.  I assume I've got to install.  I checked the LLVM Download Page under LLVM 3.0, but besides the binaries for MAC OS X, I don't know whether to download the LLVM and Clang source code.  Can you point me in the right direction?

Thanks very much.
Title: Re: Simple C Code Will Not Build
Post by: oBFusCATed on April 22, 2020, 09:54:36 pm
You need to install "xcode command line tools" or the full xcode, I'm not sure.
Title: Re: Simple C Code Will Not Build
Post by: rickb on April 23, 2020, 07:28:41 pm
OK, I installed Xcode from the Mountain Lion DVD that came with the MacBook.  Do I use Xcode as my IDE?  How do I know if the MPKG included command line tools?  Should I try compiling in Code::Blocks again?

Of course any help is appreciated.

Thanks.
Title: Re: Simple C Code Will Not Build
Post by: oBFusCATed on April 23, 2020, 07:43:23 pm
Mountain lion is old and in apple speak, its so old that it doesn't exists :)
You can try to build but first check if you have working clang or gcc. This version of xcode might contain only gcc.
Title: Re: Simple C Code Will Not Build
Post by: rickb on April 24, 2020, 12:03:57 am
I made a mistake.  I installed Xcode from a Snow Leopard DVD.  I'll check for clang and/or gcc.

Thanks again.