|
-
Sep 2nd, 2001, 06:55 PM
#1
Thread Starter
Addicted Member
Starting out in VC++ need help!
I get an error on line 19 in this code. The error is "C2228: left of '.tm_sec' must have class/struct/union type"
Code:
#include "stdafx.h"
#include <iostream.h>
#include "string.h"
#include "time.h"
int main()
{
tm * x;
int sec;
while (1==1)
{
_getsystime(x);
sec=x.tm_sec;
cout<<sec;
}
return 0;
}
What's wrong?
BTW, Thanks for all your help
Member of the anti-gay cross-dressing trans-species wolves alliance.
-
Sep 2nd, 2001, 09:26 PM
#2
PowerPoster
Yes, but the most commonly used is "->"
-
Sep 2nd, 2001, 09:26 PM
#3
Thread Starter
Addicted Member
Now I get an illegal operation error when I try to run it! It compiles fine tho
BTW, Thanks for all your help
Member of the anti-gay cross-dressing trans-species wolves alliance.
-
Sep 2nd, 2001, 09:39 PM
#4
-
Sep 3rd, 2001, 06:02 AM
#5
Frenzied Member
Make this
Code:
#include "string.h"
#include "time.h"
Code:
#include <string.h>
#include <time.h>
The stdafx.h is included by VC++ if you chose simple console app. Choose an empty project and add a cpp file.
-
Sep 3rd, 2001, 06:05 AM
#6
Monday Morning Lunatic
Is it only version 6 that adds its own stdafx.h file? I use something similar for large projects but call it stdpch.h/stdpch.cpp instead so I know it's for the precompiled headers rather than MFC
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 4th, 2001, 03:15 AM
#7
Yeah, it's actually just to make things a little bit simpler for the vc++ developers (not the users ) because they can always use "stdafx". Does not make sense, but they seem to see VC++ mainly as a tool to develop MFC Apps. I'd think too, that "stdpch" is a better name, but I don't like it in general, because you have to include the file in every source file you have.
But what'cha (spelling???????) gonnado... Big bad richmond guy has more power 
All the buzzt
CornedBee
-
Sep 4th, 2001, 04:56 AM
#8
Monday Morning Lunatic
He has the power, but I have the intelligence 
I don't have a problem with MFC when it's required...it's just I don't really like it and don't see why you should use it for most programs.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|