Post

Replies

Boosts

Views

Activity

C Code Won't Compile in MacOS Catalina or Big Sur
I am unable to compile C code on neither MacOS Catalina nor Big Sur. I see the header files present in /usr/include/, but I get errors from my C compiler. Current error messages I get from the compiler are: For "#include time.h" = error: cannot open source file "time.h" For "#include stdint.h" = error: cannot open source file "stdint.h" What I've tried:Running the following command on Catalina says "upgrade successful", but does not resolve any errors; running it on Big Sur says that "the package path specified was invalid." sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /  I tried uninstalling and reinstalling XCode - https://stackoverflow.com/questions/34617452/how-to-update-xcode-from-command-line (Version 10.1) I tried downloading the above .pkg file for Big Sur (because I was missing it) but was told my macOS version was too new The files I need are stored in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include, so I added a new CPATH and PATH variable (separately) for that path to ~/.bash_profile and /etc/paths (I can't insert the link to that article for some reason but it's entitled "Setting Up Environment Variables in MacOS" on medium.com) I tried to provide #include statements with explicit paths to those files, which quickly spiraled out of control I tried to move all of the required files from the above directory to my project folder and changing the paths appropriately in the code I tried to run the following command, - https://stackoverflow.com/questions/58278260/cant-compile-a-c-program-on-a-mac-after-upgrading-to-catalina-10-15 which made the /usr/include folder show up in my development folder but am still getting the "cannot open source file" errors sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include The files should also be stored in Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include, - https://stackoverflow.com/questions/58278260/cant-compile-a-c-program-on-a-mac-after-upgrading-to-catalina-10-15 so I tried doing the above steps with this path as well Any advice would be helpful. Thank you!
2
0
2.4k
Feb ’21