Cannot compile on Mac without specifying -isysroot flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(!! if someone can help me sort this out I’ll Venmo you $10 !!)

Hello,

After upgrading to macOS Mojave I am no longer to compile basic C++ code “out of the box” on my 2018 MacBook Pro.

In short, a “Hello world” program fails, which I am assuming the compiler cannot locate the “iostream” header. After some digging on StackOverflow I found that I can compile if and only if I set the following flag in my compilation call:

-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk

So I guess my GCC/g++ installation is by default not looking there, but if I specify the .sdk directly it finds what it needs.

What I cannot find is how to force my g++ calls to search in this directory for the default headers by default.

I found https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html <https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html>, but it seemed to be specific for general flags I can set at runtime, not information on how to generally change the default path.


Full details here:
https://stackoverflow.com/questions/52581857/cant-compile-c-hello-world-with-include-after-upgrading-to-mojave <https://stackoverflow.com/questions/52581857/cant-compile-c-hello-world-with-include-after-upgrading-to-mojave>

I’m a student still learning my way around the compiler, so sorry if any of my jargon was imprecise. Any pointers would be appreciated, as I feel as though I’ve exhausted what I can find on Google and the above StackOverflow post didn’t go anywhere.

Appreciate it!
Kyle



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux