Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPP: create platform defines #3217

Closed
certik opened this issue Jan 26, 2024 · 1 comment · Fixed by #3229
Closed

CPP: create platform defines #3217

certik opened this issue Jan 26, 2024 · 1 comment · Fixed by #3229

Comments

@certik
Copy link
Contributor

certik commented Jan 26, 2024

At least: __linux__ and __APPLE__.

@Shaikh-Ubaid
Copy link
Member

It seems like gfortran does not support __APPLE__.

% cat examples/expr2.f90 
program test

#ifdef _WIN32
    print *,'Windows'
#endif
#ifdef __linux
    print *,'Linux'
#endif
#ifdef __APPLE__
    print *,'OSX'
#endif

end program
% gfortran examples/expr2.f90 -cpp
% ./a.out 
% cat examples/expr2.cpp 
#include<iostream>

int main() {
    #ifdef _WIN32
        std::cout << "Windows" << std::endl;
    #endif
    #ifdef __linux
        std::cout << "Linux" << std::endl;
    #endif
    #ifdef __APPLE__
        std::cout << "OSX" << std::endl;
    #endif
    return 0;
}
% g++ examples/expr2.cpp          
% ./a.out 
OSX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants