News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Error

Started by tiutea, September 13, 2016, 10:37:12 AM

Previous topic - Next topic

tiutea

I tried example from Prata book and got error
CODE:

#include<iostream>
#include <ctime>
#include <cstdlib>
#include "String.h"
const int MIN_PER_HR=60;
bool newcustomer(double x);
int main(){
    using namespace std;
    srand(time(0));

    return 0;
}


P.S. downloaded and installed codeblocks 16.01 on Win7




ERROR


||=== Build: Debug in book (compiler: GNU GCC Compiler) ===|
C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\ctime|60|error: '::clock_t' has not been declared|
C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\ctime|64|error: '::clock' has not been declared|
C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\ctime|65|error: '::difftime' has not been declared|
C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\ctime|66|error: '::mktime' has not been declared|
C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\ctime|67|error: '::time' has not been declared|
C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\ctime|68|error: '::asctime' has not been declared|
C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\ctime|69|error: '::ctime' has not been declared|
C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\ctime|70|error: '::gmtime' has not been declared|
C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\ctime|71|error: '::localtime' has not been declared|
C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.9.2\include\c++\ctime|72|error: '::strftime' has not been declared|
D:\z\book\main.cpp||In function 'int main()':|
D:\z\book\main.cpp|9|error: 'time' was not declared in this scope|
||=== Build failed: 11 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|


ollydbg

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

stahta01

I suggest posting a build log in code tags instead of build messages.

I also suggest removing the include of "String.h".

http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]