User forums > Using Code::Blocks
Error
(1/1)
tiutea:
I tried example from Prata book and got error
CODE:
--- 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)) ===|
--- End code ---
ollydbg:
Read the FAQ: My simple C++ program throws up lots of errors - what is going on?
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
Navigation
[0] Message Index
Go to full version