LinuxQuestions.org
Help answer threads with 0 replies.
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
 
LinkBack Search this Thread
Old 04-24-2002, 01:21 PM   #1
ChimpFace9000
Member
 
Registered: Jul 2001
Location: So. Cal.
Distribution: Slackware 8.1
Posts: 55

Rep: Reputation: 15
Post gcc internal variables


Does gcc have any internal variables for what file its compiling and what line its on?

Something like...
Code:
printf("%s : %d\n", __file__, __line__);
 
Old 04-27-2002, 12:31 PM   #2
llama_meme
Member
 
Registered: Nov 2001
Location: London, England
Distribution: Gentoo, FreeBSD
Posts: 590

Rep: Reputation: 30
Yeah, since this feature is part of standard ANSI C. The following preprocessor symbols are defined:

__LINE__ current line number
__FILE__ name of the file being compiled
__DATE__ date (in string form)
__TIME__ (time (in string form)

(that's two underscores befre and after each symbol)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Must set up Enviroment variables for GCC 3.4.3? colintri Linux - Software 5 03-13-2005 06:42 PM
Shel scripting: variables pointing to variables and case Dark_Helmet Programming 5 06-08-2003 11:07 AM
gcc environment variables Itzac Linux - Software 1 03-25-2003 11:13 PM
gcc: Internal compiler error: program cc1 got fatal signal 11 smj Linux - Software 2 02-20-2003 10:35 AM
[gcc] internal error: segmentation fault fskmh Slackware 3 01-22-2003 05:36 PM


All times are GMT -5. The time now is 04:36 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration