Hi Team,
I'm new to c++ fmt and Xcode. When I'm trying to debug c++ fmt with Xcode GUI. I met several issues I couldn't resolve. Thanks in advance for help!
From the high level, the issues I met were shown below:
- If I modify "Header Search Paths" in "Build Settings" with path /usr/local/include/**, from Xcode GUI build it even could not find some basic c++ library
- If I used command line directly like below, it worked fine:
g++ -std=c++20 -I/usr/local/include -L/usr/local/lib -lfmt main.cpp -o main
The steps to reproduce it in Xcode GUI are as follows:
First, I followed the command line "brew install fmt" to install fmt library https://fmt.dev/latest/usage.html. Second, I created a Xcode project under "macOS" with "Command Line Tool" application. Third, I created a simple C++ file with simple code as below:
#include <iostream>
int main(int argc, const char * argv[]) {
std::cout << "Hello, World!\n";
return 0;
}
It was built and worked fine.
Forth, I edited the code with the following:
#include <iostream>
#include "fmt/core.h"
int main(int argc, const char * argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
fmt::print("Don't panic.\n")
return 0;
}
And I modified the "Header Search Paths" with /usr/local/include/** and "Library Search Paths" with the following /usr/local/lib/**.
Then when I built the project, it reported several errors even in the basic library, for example, "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk/usr/include/c++/v1/__string:350:56 No member named 'memmove' in namespace 'std::__1'; did you mean simply 'memmove'? "
Five, if I manually installed fmt library into my personal folder other than /usr. Then I added it into "Header Search Path", a different error was shown like "Undefined symbol: fmt::v9::vformat(....)"
Could someone help me on the issues above? Thanks a lot!