[LLVMbugs] [Bug 12546] New: Clang Command Line Syntax for C++?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 13 04:02:23 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12546

             Bug #: 12546
           Summary: Clang Command Line Syntax for C++?
           Product: clang
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: haziz at mac.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


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 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++

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list