[cfe-users] Part/complete compilation with clang++
Sian Mountbatten
poenikatu at fastmail.co.uk
Sat Jul 20 06:46:06 PDT 2013
Dear List
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
Segmentation violation.
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
than
GNU gdb?
Looking forward to progessing on these points.
--
Sian Mountbatten <www.poenikatu.co.uk>
Learning C++!!!
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...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20130720/4154b32e/attachment.html>
More information about the cfe-users
mailing list