User forums > General (but related to Code::Blocks)

Definition of libc++ library with Clang compiler in Code::Blocks on Ubuntu Linux

(1/2) > >>

ptolomey:
I installed Clang and libc++ in Linux Ubuntu 12.04 using instructions from the link: http://solarianprogrammer.com/2013/01/17/building-clang-libcpp-ubuntu-linux/.
Programs published in link above pass compilation and can be run, using terminal with following compilation options: clang++ -std=c++11 -stdlib=libc++.
The problem is appeared in C::B when I tried to use STL library libc++ with Clang compiler, option -stdlib=libc++ within Compiler settings -> Other options.
Everything is passing fluently in C::B when Clang compiler is used with STL library libstdc++.
How this problem can be solved?

The source code is published in link above and the compilation errors log file attached to post.

stahta01:
May guess based on this link http://stackoverflow.com/questions/12939046/forcing-clang-to-link-with-c-runtime

Try adding the library "stdc++" to the link library list.

NOTE: This is only slightly related to CB; so, the topic might be locked.

Tim S.

ptolomey:
Hi, stahta01
Thank you for reply.
The problem is does in C::B options.
I have no problems in compilation and runing the programm, when everything is done via terminal.

ptolomey:
I think I found out where the problem is.

When I use the terminal the compilation command is:

--- Code: ---clang++ -std=c++11 -stdlib=libc++ -g <filename>.cpp -o <filename>
--- End code ---

This command make an executable file if compilation pass.

In case of C::B, first of all created objective file, and only after that executable is created.
There are two commands in C::B:

* first for compilation and creation of objective file
* second for linking

--- Code: ---#1 clang++ -std=c++11 -stdlib=libc++ -g -c <filename>.cpp -o obj/Debug/<filename>.o
#2 clang++ -o /bin/debug/<filename> obj/Debug/<filename>.o

--- End code ---

The command in 2-nd line created by C::B automaticly.
Based on attached Error Log file, it can be seen that errors start to appear after command in 2-nd line.
I belive that automaticly created command in 2-nd line, should look like following:

--- Code: ---clang++ obj/Debug/<filename>.o -o /bin/debug/<filename>

--- End code ---

Currently I have no accesses to PC with installed Clang.
Today at evening I will check this option using command line.

[attachment deleted by admin]

oBFusCATed:

--- Quote from: ptolomey on April 09, 2013, 09:24:25 am ---I belive that some compiler flags are missing in automaticly created 2-nd line command.

--- End quote ---
Please use you console to play with it and tell us which flags.

Navigation

[0] Message Index

[#] Next page

Go to full version