Bug 62926 - Its impossible to compile any programs, used math.h with g++
Summary: Its impossible to compile any programs, used math.h with g++
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.2
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL: no URL for this BUg
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-04-07 20:56 UTC by Garaschenko Slava
Modified: 2007-04-18 16:41 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-04-07 20:56:38 UTC
Embargoed:


Attachments (Terms of Use)

Description Garaschenko Slava 2002-04-07 20:56:33 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.0 (X11; Linux i686; U;) Gecko/20020311

Description of problem:
Then i compilling program with function round() for example, the compiller
generate error: `round' undeclared (first use this function). 
With g++3 all ok but with g++ - we have error :(

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
type program such this:
#include <stdio.h>
#include <math.h>
#include <printf.h>
int main() {
  printf("Its integer:%i\n",(int)round(6.99999));
 }
Save it as testmat.cpp
then use:
g++ testmat.cpp -o testmat -lm

	

Actual Results:  [slava@maze PrintTest]$ g++ -Wall testmat.cpp -o testmat -lm
testmat.cpp: In function `int main ()':
testmat.cpp:10: `round' undeclared (first use this function)
testmat.cpp:10: (Each undeclared identifier is reported only once for 
each function it appears in.)


Expected Results:  use g++3 -Wall testmat.cpp -o testmat -lm  
All ok. Why ?


Additional info:

Please, help with this if you can :(

Comment 1 Jakub Jelinek 2002-04-07 21:27:55 UTC
It is because round(3) is available only in the ISO C99 feature set
(see features.h and info libc for information about feature macros).
Try g++ -D_ISOC99_SOURCE or g++ -D_GNU_SOURCE
It works with g++3 because it hardcodes -D_GNU_SOURCE ATM.


Note You need to log in before you can comment on or make changes to this bug.