Some issues about compiling in Macos
FanxwGit opened this issue · 5 comments
I want to use the GNU g++ in MacOs
set the path and alias in the ~/.bash_profile and ~/.zshrc
like this
~/.bash_profile
export PAHT=/opt/homebrew/bin/gcc-13:$PATH
alias gcc=gcc-13
alias g++=g++-13
~/.zshrc
alias gcc=gcc-13
alias g++=g++-13
export PAHT=/opt/homebrew/bin/gcc-13:$PATH
source ~/.bash_profile
and it really works in both my terminal and vscode terminal (zsh and bash)
~ % g++ --version
g++-13 (Homebrew GCC 13.2.0) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
but it doesn't work actually in the CPH, i use the flowing code to test the defualt compiler.
#include <iostream>
int main()
{
#if defined(__GNUC__) && defined(__clang__)
std::cout << "This is Clang's g++" << std::endl;
#elif defined(__GNUC__)
std::cout << "This is GNU's g++" << std::endl;
#else
std::cout << "This is some other g++" << std::endl;
#endif
return 0;
}
As shown in the figure below, cph use the clang g++ compiler inteated of gun g++.
![image](https://private-user-images.githubusercontent.com/78842723/301019150-4f6a147f-122c-4772-9a48-496b30eb4e9e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTUwODY1MDAsIm5iZiI6MTcxNTA4NjIwMCwicGF0aCI6Ii83ODg0MjcyMy8zMDEwMTkxNTAtNGY2YTE0N2YtMTIyYy00NzcyLTlhNDgtNDk2YjMwZWI0ZTllLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTA3VDEyNTAwMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc0ZGMyMzM3Mzg1Y2MwZmQ3OTZkMmJmOTZjZDgzZTdiOWZmMjk1ZmQ3MTgyNWZlNzk2M2I4MmFhMTZmYmRmNjQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0._9ci18DI1qBfbB4U4fwFk6LcE3Xb2bsEJE-qDUigmK4)
So, If i want to use the gun g++, how to do that?
CPH is a very good extension, i would be appreciated if you help me solve this problem, thanks.
Hey! I am encountering a very similar issue.
My code isn't running using the cph extension. It always shows "SIGKILL" as the output. However, the code runs fine in the terminal
I have also just switched from clang to GCC on my mac
Do you know of any way to resolve this?
I haven't encountered this problem yet. Have you correctly configured g++ (your version) in the settings, just like I did?
Hey! I am encountering a very similar issue.
My code isn't running using the cph extension. It always shows "SIGKILL" as the output. However, the code runs fine in the terminal
I have also just switched from clang to GCC on my mac
Do you know of any way to resolve this?I haven't encountered this problem yet. Have you correctly configured g++ (your version) in the settings, just like I did?
Yep