LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 02-06-2004, 08:29 AM   #1
fab12
LQ Newbie
 
Registered: Feb 2004
Posts: 2

Rep: Reputation: 0
gcc bug?


Hi,
I made the following program and get an error line10 when compiling with
gcc 3.3.2.

#define DEF1

main()
{
#ifdef DEF1

printf("Hello world");

#else
"DEF1 must be defined
DEF1 must be defined"
#endif /* DEF1 */
}


Bit strange to have a compilation error here since DEF1 is defined.
If I remove both " after #else it's Ok. Also if I remove the \n at the end
of DEF1 must be defined.

Seems like a preprocessor bug, isn't it?

Thanks
Fabien
 
Old 02-06-2004, 09:45 AM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
Try:
Code:
#else
"DEF1 must be defined  \
DEF1 must be defined"
#endif /* DEF1 */
Plus, cpp (the preprocessor) expects valid stuff in there, not just an
improperly terminated string.
 
Old 02-07-2004, 07:44 AM   #3
fab12
LQ Newbie
 
Registered: Feb 2004
Posts: 2

Original Poster
Rep: Reputation: 0
Bug?

Thanks but actually my question is is it a bug of this gcc version?
Because I do not have this error with other gcc versions.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
bug reports on glibc or gcc tvburger Linux From Scratch 1 12-06-2004 12:43 AM
gcc wont install, 'failed dependencies: glibc-devel is needed by gcc-3.3.3-41' TdlSnare Suse/Novell 3 11-29-2004 02:13 PM
Free86 bug or nVidia bug?? ProtoformX Linux - Software 2 05-12-2004 02:38 AM
Extremely strange bug in gcc/g++ Maidros Linux - Software 3 05-08-2004 06:28 AM
export CC=/usr/bin/gcc-3.2 - switch gcc version? ferreter Linux - Software 1 08-20-2003 12:07 AM


All times are GMT -5. The time now is 07:15 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 Google+: linuxquestions
Open Source Consulting | Domain Registration