<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Works great Jean-Daniel! Thanks a lot!<div><br></div><div>Regards,<br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Rob J. Goedman</div><div><a href="mailto:goedman@icloud.com">goedman@icloud.com</a></div><div><br></div></div></span><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">
</div>
<br><div><div>On Nov 25, 2013, at 10:49 AM, Jean-Daniel Dupas <<a href="mailto:devlists@shadowlab.org">devlists@shadowlab.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br>On OS X Maverick, libc++ headers are part of the compiler toolchain and not of the system. That's why when using a custom toolchain (or clang based tool), you got this error.<br><br>To use libc++ with your own clang build, you have to install it alongside your clang binary.<br><br>The good news is that it will be automatically done when installing clang if you checkout the libc++ project at the right place, that is in <llvm sources>/projects/libcxx<br><br>cd <llvm sources>/projects<br>svn co <a href="http://llvm.org/svn/llvm-project/libcxx/trunk">http://llvm.org/svn/llvm-project/libcxx/trunk</a> libcxx<br><br>Now, go to your build directory and run make install again.<br><br>It should install the clang tools and libc++ headers at the right place, and clang should find them.<br><br>Note that if you want to know where clang look for the libc++ headers, you can pass the "-v" flags to the compiler to tell it to print the header search path.<br><br>Le 25 nov. 2013 à 19:14, Robert J Goedman <<a href="mailto:goedman@icloud.com">goedman@icloud.com</a>> a écrit :<br><br><blockquote type="cite">Hi,<br><br>After watching Chandler Carruth's <a href="http://channel9.msdn.com/Events/GoingNative/2013/The-Care-and-Feeding-of-C-s-Dragons">http://channel9.msdn.com/Events/GoingNative/2013/The-Care-and-Feeding-of-C-s-Dragons</a> I decided to try the format and modernize examples in the middle of his presentation. After installing the latest LLVM suite, all examples without #include files work fine, both in clang-format and clang-modernize. Very impressive.<br><br>Using the native (Apple, Xcode) toolchain, I can cmake, make and run the example programs in a build directory directly under the source directory, e,g. clang-tools/vector/build under clang-tools/vector which contains vector.cpp and CMakeLists.txt.<br><br>But clang-modernize will fail *if* it contains a template based #include, e.g. Chandler's loop-convert example based on a small vector<int> loop.<br>Somehow I can't figure out how to specify the right flags for the compiler/linker in cmakelist.txt.<br><br>Any pointers appreciated!<br><br>Thanks,<br>Rob J. Goedman<br><a href="mailto:goedman@icloud.com">goedman@icloud.com</a><br><br>------------/clang-tools/vector/vector.cpp------------<br><br>#include <vector><br>#include <iostream><br><br>int sum(const std::vector<int> &numbers) {<br> int result = 0;<br> for (std::vector<int>::const_iterator it = numbers.begin();<br> it != numbers.end(); ++it) {<br> result += *it;<br> }<br> return result;<br>}<br><br>int main() {<br> std::vector<int> nums = { 1, 5, 6, 38 };<br> std::cout << sum(nums) << std::endl;<br>}<br><br>-------------/clang-tools/vector/CMakeLists.Txt<br><br>project(foundations)<br>cmake_minimum_required(VERSION 2.8)<br><br>include_directories($ENV{GMOCK_HOME}/include $ENV{GMOCK_HOME}/gtest/include)<br>link_directories($ENV{GMOCK_HOME}/mybuild $ENV{GMOCK_HOME}/gtest/mybuild)<br>add_definitions(-stdlib=libc++ -std=c++11)<br><br>set(sources <br> vector.cpp<br>)<br><br>add_executable(test ${sources})<br>target_link_libraries(test pthread)<br>target_link_libraries(test gmock)<br>target_link_libraries(test gtest)<br><br>-----------------------<br><br>robs-15inch-2:build rob$ rm -rf *<br>robs-15inch-2:build rob$ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..<br>-- The C compiler identification is Clang 5.0.0<br>-- The CXX compiler identification is Clang 5.0.0<br>-- Check for working C compiler: /usr/bin/cc<br>-- Check for working C compiler: /usr/bin/cc -- works<br>-- Detecting C compiler ABI info<br>-- Detecting C compiler ABI info - done<br>-- Check for working CXX compiler: /usr/bin/c++<br>-- Check for working CXX compiler: /usr/bin/c++ -- works<br>-- Detecting CXX compiler ABI info<br>-- Detecting CXX compiler ABI info - done<br>-- Configuring done<br>-- Generating done<br>-- Build files have been written to: /Users/rob/Projects/Languages/Cpp/clang_tools/vector/build<br>robs-15inch-2:build rob$ make<br>Scanning dependencies of target test<br>[100%] Building CXX object CMakeFiles/test.dir/vector.cpp.o<br>Linking CXX executable test<br>[100%] Built target test<br>robs-15inch-2:build rob$ ./test<br>50<br>robs-15inch-2:build rob$ clang-format -style LLVM -i ../vector.cpp <br>robs-15inch-2:build rob$ clang-modernize -summary -p . -include ..<br>Parse: /Users/rob/Projects/Languages/Cpp/clang_tools/vector<br>/Users/rob/Projects/Languages/Cpp/clang_tools/vector/vector.cpp:1:10: fatal error: 'vector' file not found<br>#include <vector><br> ^<br>1 error generated.<br>Error while processing /Users/rob/Projects/Languages/Cpp/clang_tools/vector/vector.cpp.<br>Error encountered during translation.<br><br>_______________________________________________<br>cfe-users mailing list<br>cfe-users@cs.uiuc.edu<br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users<br></blockquote><br>-- Jean-Daniel<br><br><br><br><br></blockquote></div><br></div></body></html>