LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-18-2019, 09:23 PM   #1
dogpatch
Member
 
Registered: Nov 2005
Location: Central America
Distribution: Mepis, Android
Posts: 490
Blog Entries: 4

Rep: Reputation: 238Reputation: 238Reputation: 238
Question GCC pre-compile directive indicating Linux or BSD


Is there a pre-compile directive in GCC that will indicate whether it is compiling on a Linux system or BSD (or other) OS?
 
Old 01-18-2019, 10:03 PM   #2
dogpatch
Member
 
Registered: Nov 2005
Location: Central America
Distribution: Mepis, Android
Posts: 490

Original Poster
Blog Entries: 4

Rep: Reputation: 238Reputation: 238Reputation: 238
I think i've answered my own question.
Code:
#ifdef __linux__
 
Old 01-20-2019, 03:00 PM   #3
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,784

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
FYI, I think what you're talking about is called a preprocessor directive, not "pre-compile". From the title, I thought at first that you were asking about precompiled headers.
 
1 members found this post helpful.
Old 01-25-2019, 10:18 AM   #4
dogpatch
Member
 
Registered: Nov 2005
Location: Central America
Distribution: Mepis, Android
Posts: 490

Original Poster
Blog Entries: 4

Rep: Reputation: 238Reputation: 238Reputation: 238
My lexicon stands corrected
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PC BSD, Open BSD, or Free BSD ? Alexvader *BSD 5 02-08-2010 12:40 AM
Indicating that I have ever posted once ;-) stilter LinuxQuestions.org Member Intro 1 11-25-2008 03:24 PM
PCI messages indicating a problem on boot robprentice Fedora 6 06-19-2006 12:53 AM
lost~ indicating home dir JesseMor Slackware 6 01-29-2006 04:49 PM
Indicating external argument into loops in SCRIPTs linsson Programming 7 07-28-2004 12:55 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration