Post

Replies

Boosts

Views

Activity

Command line compilation problem, standard includes not found
This example fails to compile on Sequoia 15.4 with Xcode 16.3 and the command line tools installed; jacquesmenu@macstudio:C++Tests > cat pcount_test.cpp // clang++ -std=c++17 -o IntWrapperTest IntWrapperTest.cpp #include // std::string #include // std::cout #include // std::ostringstream int main1 (int argc, char* argv[]) { std::string theString = "Prière d'éviter"; std::cout << theString << ", size(): " << theString.size () << std::endl; std::stringstream oss; oss << theString << std::endl; std::cout << oss.str () << ", pcount(): " << oss.pcount () << std::endl; } //_______________________________________________________________________________ // position in output stream #include // std::ofstream int main () { std::ofstream outfile; outfile.open ("test.txt"); outfile.write ("This is an apple",16); long pos = outfile.tellp(); outfile.seekp (pos-7); outfile.write (" sam",4); outfile.close(); return 0; } jacquesmenu@macstudio:C++Tests > clang++ pcount_test.cpp pcount_test.cpp:3:10: fatal error: 'string' file not found 3 | #include // std::string | ^~~~~~~~ 1 error generated. The same occurs with iostrem if it is the first include mentioned. Compiling in Xcode itself does not this problem, though. This include is to be found here: jacquesmenu@macstudio:C++Tests > xcode-select -p /Applications/Xcode.app/Contents/Developer jacquesmenu@macstudio:C++Tests > ls -sal /Applications/Xcode.app/Contents/Developer/**/string | grep MacOSX 72 -rw-r--r-- 10 root wheel 203802 Mar 8 06:17 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/string
3
0
75
Apr ’25
How to build CLI tools with clang++ on Big Sur
Hello, I develop CLI C++11 tools that need to run on Mojave and Big Sur. When I just switched to the latter, I found that adding:-target=x86_64-apple-darwin20.3.0 to the clang++ command did the trick, but it is too tied to the present darwin version. What is the recommended way to build my tools in order for them to run both in Mojave and Big Sur? Thanks!
0
0
412
Apr ’21