473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Including time.h header causes VC 7.1 to barf ? ...

Hi I'm compiling some code and need to generate some random numbers. To
save time, I decided to use the srand, rand and time functions.

My code worked (atleast built fine) until I added time.h, then the
compiler (VC7.1) barfed up this lot:

c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(156) : error C2143: syntax error : missing ','
before '*'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(158) : error C2065: 'time_t' : undeclared identifier
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(158) : error C3861: 'time_t': identifier not
found, even with argument-dependent lookup
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(158) : warning C4229: anachronism used :
modifiers on data are ignored
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(158) : error C2078: too many initializers
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(159) : error C2143: syntax error : missing ','
before '*'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(160) : error C2143: syntax error : missing ','
before '*'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(161) : error C2143: syntax error : missing ';'
before '__cdecl'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(161) : error C2501: 'time_t' : missing
storage-class or type specifiers
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(161) : error C2371: 'time_t' : redefinition;
different basic types
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(166) : error C2143: syntax error : missing ';'
before '__cdecl'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(166) : error C2501: 'time_t' : missing
storage-class or type specifiers
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(166) : error C2371: 'time_t' : redefinition;
different basic types
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(166) : error C2059: syntax error : ')'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(175) : error C2143: syntax error : missing ','
before '*'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(176) : error C2143: syntax error : missing ','
before '*'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(177) : error C2143: syntax error : missing ','
before '*'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(178) : error C2143: syntax error : missing ';'
before '__cdecl'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(178) : error C2501: '__time64_t' : missing
storage-class or type specifiers
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(179) : error C2143: syntax error : missing ';'
before '__cdecl'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(179) : error C2501: '__time64_t' : missing
storage-class or type specifiers
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(179) : error C2086: 'int __time64_t' : redefinition
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(178) : see declaration of '__time64_t'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(179) : error C2059: syntax error : ')'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(199) : error C2143: syntax error : missing ','
before '*'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\time.h(206) : error C2143: syntax error : missing ','
before '*'

This is not the first time I have seen the compiler complain about a set
of core (i..e Microsoft supplied) headers. Does anyone know what is
going on?. Is this a bug?

In case anyone was wondering, the code am writing is a one source file
and there are no #defines so I don't think this is due to name
collisions. I will be very grateful to hear from someone who knows the
cause of this.

Nov 17 '05 #1
1 3564
Hi Alfonso!
Hi I'm compiling some code and need to generate some random numbers. To
save time, I decided to use the srand, rand and time functions.

My code worked (atleast built fine) until I added time.h, then the
compiler (VC7.1) barfed up this lot:


For me the following works perfectly:

#include <stdio.h>
#include <time.h>
#include <tchar.h>

int _tmain()
{
return 0;
}
--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Sarath | last post by:
I am working with an application using ASP, getting below error when i am trying to include new asp include file. _____________________________________________________________________ Microsoft...
11
by: cppaddict | last post by:
Say that your CustomClass.h header files requires #include <string> Now say that your CustomClass.cpp file also requires string. Is it good form to repeat the <string> include to make the...
8
by: nrhayyal | last post by:
Hi c++ Gurus, Need your blessing. while testing few aspects with respect to header file inclusions, i observed few things which i would like to share with you. i have a file sqlca.h in which a...
6
by: Al-Burak | last post by:
I have a class which only purpose is to provide services to a variety of classes in other files. The 'manipulator' class is aware of the other classes only because the header files have been...
3
by: Nobody | last post by:
I posted this bug to MS, but was wondering if someone else could try inserting the following into a C++/cli project and seeing if it causes the compiler to barf: array<float,2>^ fMatrix = gcnew...
4
by: 'Mani | last post by:
Hi, This is just a generic question, where i want to know what is the difference in including a header file in a .h file and .cpp file. I have a class called MyClass (MyClass.h & MyClass.cpp)....
18
by: sam_cit | last post by:
Hi Everyone, int main() { printf("not included stdio.h"); } Yes, i haven't included stdio.h and my compiler would generate a warning and would assume that it would return a int, my question...
5
by: 2291980 | last post by:
Hello can any body tell me the dff between function redirect($url) { echo "<script>"; echo "window.location='".$url."'"; echo "</script>";
8
by: nguillot | last post by:
Hello. If I have the following classes: class B {}; typedef B tB; if A is: class A
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.