Win functions not working under win console
Hey Olesuyi...maybe I'm dense here, but I've been trying to get windows types and fucntions to work in a windows console application in VC++ 6.0
So, I remembered when you posted that you should include winmm.lib in the project, and put mmsystem.h as include. But anyway it doesnt recognize my types. I even tried including windows.h
Is there something else that needs to be done?
-=Lohrno
[edited by - Lohrno on April 12, 2002 8:48:04 PM]
what''s the compiler and/or linker error(s) that you''re getting?
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
It''s just not recognizing DWORD as a type, you know, things like that.
-=Lohrno
-=Lohrno
Things like that? Well, you might need windows.h and windowsx.h included, considering those hold most of the win functions.
i''m using MSVS.NET but i don''t think there should be a difference. DWORD is typedef''d in "windef.h".
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
I use ''winmm.lib'' for timeGetTime(); (and ''mmystem.h'' ,I think) and have found no problems. How about posting some code ?
Also What are you compiling under ?? (VS C++ 6)
,Jay
Also What are you compiling under ?? (VS C++ 6)
,Jay
If you''re going to address a thread to me (you shouldn''t; the FAQ says not to) or send me email, have the fucking courtesy to lookup the spelling of my name.
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! | Asking Smart Questions ]
Thanks to Kylotan for the idea!
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! | Asking Smart Questions ]
Thanks to Kylotan for the idea!
Well, you're a very nice guy I see (I'm glad thats not what they pay you for! =D) I don't rip people a new one everytime they say "Lorno" or "Lorhno" =P But do you have any response for my question? =( (beside a hand outstretched with the middle finger extended)
-=Lohrno
Edit: Ok, I'll post everything:
Linked:
winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
-=Lohrno
[edited by - Lohrno on April 12, 2002 8:51:51 PM]
[edited by - Lohrno on April 12, 2002 8:53:54 PM]
-=Lohrno
Edit: Ok, I'll post everything:
#include <windows.h>#include <mmsystem.h>#include <iostream.h>#include "stdafx.h"class Timer{ public: void check(void(*Function)()); Timer(); void SetInterval(int inter); private: DWORD interval; DWORD time;};Timer::Timer(){ interval = 1000; time = timeGetTime();}Timer::check(void(*Function)()){ if ((time+interval)<timeGetTime()) { Function(); time=timeGetTime(); }}Timer::SetInterval(int inter){ interval=inter}void display(){ cout << "Hi!" << endl;}int main(int argc, char* argv[]){ Timer Checker; Checker.SetInterval(300); while (1) { Checker.check(display); } return 0;} Errors: (I'm putting them in a source box so they dont take up the whole page) /*--------------------Configuration: TestTimer - Win32 Debug--------------------Compiling...TestTimer.cppC:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(13) : error C2146: syntax error : missing ';' before identifier 'interval'C:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(13) : error C2501: 'DWORD' : missing storage-class or type specifiersC:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(13) : error C2501: 'interval' : missing storage-class or type specifiersC:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(14) : error C2146: syntax error : missing ';' before identifier 'time'C:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(14) : error C2501: 'DWORD' : missing storage-class or type specifiersC:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(14) : error C2501: 'time' : missing storage-class or type specifiersC:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(19) : error C2065: 'interval' : undeclared identifierC:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(20) : error C2065: 'time' : undeclared identifierC:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(20) : error C2065: 'timeGetTime' : undeclared identifierC:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(24) : error C2556: 'int __thiscall Timer::check(void (__cdecl *)(void))' : overloaded function differs only by return type from 'void __thiscall Timer::check(void (__cdecl *)(void))' C:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(9) : see declaration of 'check'C:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(24) : error C2371: 'check' : redefinition; different basic types C:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(9) : see declaration of 'check'C:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(33) : error C2556: 'int __thiscall Timer::SetInterval(int)' : overloaded function differs only by return type from 'void __thiscall Timer::SetInterval(int)' C:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(11) : see declaration of 'SetInterval'C:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(33) : error C2371: 'SetInterval' : redefinition; different basic types C:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(11) : see declaration of 'SetInterval'C:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(35) : error C2143: syntax error : missing ';' before '}'C:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(39) : error C2065: 'cout' : undeclared identifierC:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(39) : error C2297: '<<' : illegal, right operand has type 'char [4]'C:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(39) : error C2065: 'endl' : undeclared identifierC:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(45) : error C2264: 'SetInterval' : error in function definition or declaration; function not calledC:\Documents and Settings\Lohrno\Desktop\TestTimer\TestTimer.cpp(48) : error C2264: 'check' : error in function definition or declaration; function not calledError executing cl.exe.TestTimer.exe - 19 error(s), 0 warning(s)*/
Linked:
winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
-=Lohrno
[edited by - Lohrno on April 12, 2002 8:51:51 PM]
[edited by - Lohrno on April 12, 2002 8:53:54 PM]
Shouldn''t you be including your PCH header (stdafx.h) before everything else? And please stop using <iostream.h>. It''s not Standard C++. Use <iostream>, no .h extension.
Nice is for pansies.
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! | Asking Smart Questions ]
Thanks to Kylotan for the idea!
Nice is for pansies.
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! | Asking Smart Questions ]
Thanks to Kylotan for the idea!
quote: Original post by Lohrno
I don''t rip people a new one everytime they say "Lorno" or "Lorhno"...
It''s probably not your first name. And I don''t make people concessions with my name because there is a general tendency to think "oh, it''s too difficult to write/pronounce." It''s only seven letters - four syllables - that all occur in the English/German/French/Spanish/Italian/Portuguese/other indo-European languages. I say/write your names, you say/write mine.
[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! | Asking Smart Questions ]
Thanks to Kylotan for the idea!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement