[cfe-users] Part/complete compilation with clang++
poenikatu at fastmail.co.uk
Sat Jul 20 06:46:06 PDT 2013
I have a small program which contains the code shown on page 1058 of
Stroustrup's TC++PL (4th ed.) just above the 37.2.1 section. I omitted
the line which initialises (and declares) pat1.
If I compile the file main.cpp to regex using this command:
clang++ -g -std=c++11 -stdlib=libc++ -o regex main.cpp
I get no warnings, no errors, in fact no console output from clang++.
When the program is run, it produces "\w+\d*" on the console.
Now, if I compile with this command:
clang++ -g -std=c++11 -o main.o -c main.cpp
and then link with this command:
clang++ -g -stdlib=libc++ -o regex main.o
again, I get no output from clang++. Unfortunately, when the output
program is run, it fails with "Segmentation violation".
Does this mean that when I start writing programs which are made up
of many source files, I shall be unable to compile the individual files?
I am trying to use Code::Blocks as the IDE for clang++. The commands it
issues are peculiar and, especially, the linker is, I reckon, just plain
wrong. The point is that the Code::Blocks binary also fails with a
So what's going wrong? Can clang++ act, not only as a compiler, but also a
linker? And is it possible to use a debugger from the LLVM stable rather
Looking forward to progessing on these points.
Sian Mountbatten <www.poenikatu.co.uk>
I'm an FSF member (no. 10888)
Help us support software freedom! http://www.fsf.org/jf?referrer=10888
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-users