Author Topic: Simple C Code Will Not Build  (Read 4960 times)

Offline rickb

  • Single posting newcomer
  • *
  • Posts: 8
Simple C Code Will Not Build
« 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. 

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Simple C Code Will Not Build
« Reply #1 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline rickb

  • Single posting newcomer
  • *
  • Posts: 8
Re: Simple C Code Will Not Build
« Reply #2 on: April 19, 2020, 11:35:40 pm »
No, I get the same messages.  Thanks for replying.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Simple C Code Will Not Build
« Reply #3 on: April 19, 2020, 11:56:06 pm »
Did you install the Clang compiler?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline rickb

  • Single posting newcomer
  • *
  • Posts: 8
Re: Simple C Code Will Not Build
« Reply #4 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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Simple C Code Will Not Build
« Reply #5 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.
« Last Edit: April 20, 2020, 08:18:06 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Simple C Code Will Not Build
« Reply #6 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.
« Last Edit: April 20, 2020, 08:27:56 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Simple C Code Will Not Build
« Reply #7 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.
(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!]

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Simple C Code Will Not Build
« Reply #8 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline rickb

  • Single posting newcomer
  • *
  • Posts: 8
Re: Simple C Code Will Not Build
« Reply #9 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Simple C Code Will Not Build
« Reply #10 on: April 21, 2020, 07:45:57 pm »
OK, does compiling work now?
(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!]

Offline rickb

  • Single posting newcomer
  • *
  • Posts: 8
Re: Simple C Code Will Not Build
« Reply #11 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Simple C Code Will Not Build
« Reply #12 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?
(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!]

Offline rickb

  • Single posting newcomer
  • *
  • Posts: 8
Re: Simple C Code Will Not Build
« Reply #13 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Simple C Code Will Not Build
« Reply #14 on: April 22, 2020, 09:54:36 pm »
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!]

Offline rickb

  • Single posting newcomer
  • *
  • Posts: 8
Re: Simple C Code Will Not Build
« Reply #15 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Simple C Code Will Not Build
« Reply #16 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.
(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!]

Offline rickb

  • Single posting newcomer
  • *
  • Posts: 8
Re: Simple C Code Will Not Build
« Reply #17 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.