Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #15260 > unrolled thread

Command Line Clang C++ Compilation Syntax?

Started byhaziz <hsaziz@gmail.com>
First post2012-04-09 12:43 -0700
Last post2012-04-10 05:40 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.lang.c++


Contents

  Command Line Clang C++ Compilation Syntax? haziz <hsaziz@gmail.com> - 2012-04-09 12:43 -0700
    Re: Command Line Clang C++ Compilation Syntax? Victor Bazarov <v.bazarov@comcast.invalid> - 2012-04-09 16:24 -0400
    Re: Command Line Clang C++ Compilation Syntax? Juha Nieminen <nospam@thanks.invalid> - 2012-04-10 05:40 +0000

#15260 — Command Line Clang C++ Compilation Syntax?

Fromhaziz <hsaziz@gmail.com>
Date2012-04-09 12:43 -0700
SubjectCommand Line Clang C++ Compilation Syntax?
Message-ID<16609632.81.1334000606237.JavaMail.geo-discussion-forums@pbaf6>
How do you use Clang from the command line to compile a C++ program?

Both

clang helloworld.cpp -o helloworld

and

clang++ helloworld.cpp -o helloworld

produce errors and fail to compile. I use clang everyday as my standard C compiler but this is the first time I am experimenting with it for C++.

This was tested and will be used on both a Linux system and Mac OsX (from the command line). I have perused the man pages (and Google) but no answer jumped out at me.

For example on the Mac (Clang/LLVM installed from the apple devloper website):

$> clang helloworld.cpp -o helloworld.cpp 
clang: warning: not using the clang compiler for C++ inputs
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:43:suffix or operands invalid for `push'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:74:suffix or operands invalid for `push'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:78:suffix or operands invalid for `push'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:186:suffix or operands invalid for `pop'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:199:suffix or operands invalid for `push'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:203:suffix or operands invalid for `push'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:210:suffix or operands invalid for `pop'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:228:suffix or operands invalid for `pop'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:236:suffix or operands invalid for `push'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:240:suffix or operands invalid for `push'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:247:suffix or operands invalid for `pop'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:268:suffix or operands invalid for `pop'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:275:suffix or operands invalid for `push'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:292:suffix or operands invalid for `push'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:296:suffix or operands invalid for `push'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:303:suffix or operands invalid for `pop'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:309:suffix or operands invalid for `pop'
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:20606:unknown section type: non_lazy_symbol_pointers
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:20606:Rest of line ignored. 1st junk character valued 76 (L).
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:20607:Unknown pseudo-op: .indirect_symbol
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:20607:Rest of line ignored. 1st junk character valued 95 (_).
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:20610:Unknown pseudo-op: .indirect_symbol
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:20610:Rest of line ignored. 1st junk character valued 95 (_).
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:20613:Unknown pseudo-op: .indirect_symbol
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:20613:Rest of line ignored. 1st junk character valued 95 (_).
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:20616:Unknown pseudo-op: .indirect_symbol
/var/folders/Ey/EybKRC12G0eU3pFMvTGK9k+++TI/-Tmp-/cc-2hoOgm.s:20616:Rest of line ignored. 1st junk character valued 95 (_).
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
Retested with clang++ again on the Mac:

$> clang++ helloworld.cpp -o helloworld 
zsh: command not found: clang++
$> clang++ --help
zsh: command not found: clang++

[toc] | [next] | [standalone]


#15262

FromVictor Bazarov <v.bazarov@comcast.invalid>
Date2012-04-09 16:24 -0400
Message-ID<jlvghb$945$1@dont-email.me>
In reply to#15260
On 4/9/2012 3:43 PM, haziz wrote:
> How do you use Clang from the command line to compile a C++ program?

I don't.

> [...]

On a serious note, tools and their command lines are off-topic here. 
Try asking in the newsgroup dedicated to the tool or to the OS on which 
that tool runs.  Often reading the documentation helps, or plain ol' 
googling.

V
-- 
I do not respond to top-posted replies, please don't ask

[toc] | [prev] | [next] | [standalone]


#15263

FromJuha Nieminen <nospam@thanks.invalid>
Date2012-04-10 05:40 +0000
Message-ID<4f83c7c9$0$3062$7b1e8fa0@news.nbl.fi>
In reply to#15260
haziz <hsaziz@gmail.com> wrote:
> $> clang helloworld.cpp -o helloworld.cpp 
> clang: warning: not using the clang compiler for C++ inputs

  What's unclear about that?

> $> clang++ helloworld.cpp -o helloworld 
> zsh: command not found: clang++

  Likewise I fail to see what's unclear about that.

  If you want to use clang++, you have to install it first (duh).

  If you are using a Mac and have Xcode installed, the current version
has an option to download and install the command-line utilities
(under Xcode > Preferences > Downloads).

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.c++


csiph-web