Bug 62926 - Its impossible to compile any programs, used math.h with g++
Its impossible to compile any programs, used math.h with g++
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
no URL for this BUg
Depends On:
  Show dependency treegraph
Reported: 2002-04-07 16:56 EDT by Garaschenko Slava
Modified: 2007-04-18 12:41 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-04-07 16:56:38 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Garaschenko Slava 2002-04-07 16:56:33 EDT
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:

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 17:27:55 EDT
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.