News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Simple C Code Will Not Build

Started by rickb, April 19, 2020, 11:00:13 PM

Previous topic - Next topic

rickb

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. 

stahta01

The directions say to leave off the bin folder!
Please remove the bin from end of the path; does it work then?

Tim S.
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]

rickb

No, I get the same messages.  Thanks for replying.

stahta01

Did you install the Clang compiler?

Tim S.
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]

rickb

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.

stahta01

#5
Quote from: 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.

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.
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]

stahta01

#6
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.
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]

oBFusCATed

@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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

stahta01

Since the poster would not say he installed a CLang compiler it is all speculation.

Tim S.
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]

rickb

@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.

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

rickb

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.

oBFusCATed

It is telling you that clang++ doesn't exists.
Have you tried running clang++ from a terminal? Does it work?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

rickb

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.

oBFusCATed

You need to install "xcode command line tools" or the full xcode, I'm not sure.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]