I am fairly new to c++ but taking a course in it at uni which is adapted to unix systems but using code::blocks to practise from home. The recommended compiler command in the unix systems is:
Quoteg++ -g -std=c++98 -pedantic -Wall -Wextra lab1.cc
.
Trying to compile a basic function example I get errors when using c::b. Code below:
double divide(double a, double b)
{
if (std::fabs(b) < 1.0 &&
std::fabs(a) > std::numeric_limits<double>::max()*std::fabs(b))
throw std::overflow_error("arithmetic_error");
double result = a / b;
if (a != 0 && result == 0.0)
throw std::underflow_error("arithmetic_error");
return result;
}Compiling results in the following errors:
Quoteerror: 'fabs' is not a member of 'std'
error: 'overflow_error' is not a member of 'std'
error: 'underflow_error' is not a member of 'std'
If code::blocks uses a newer standard or such, can I adjust compiler to simulate the recommended course settings? I want to be able to practise in the standard I am supposed to use at the exam. Please help me!
Quote from: dacascos on November 07, 2009, 06:01:31 PM
If code::blocks uses a newer standard or such,
Code::Blocks is an IDE, not a compiler. So you are talking about compiler errors, which we don't support. This question is therefore not related to Code::blocks and thus violates our forum rules. Try a GCC / C++ forum, please.
Topic locked.