C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 03-09-2006, 11:36 PM   #1
Registered User
 
Join Date: Mar 2006
Posts: 21
Using VC Toolkit 2003

I tried to compile a source file that I already had, but I got several errors pertaining to my include files...

Code:
>cl /c wussemblem.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

wussemblem.c
C:\C\include\stdlib.h(136) : error C2059: syntax error : 'type'
C:\C\include\WIN.H(8200) : warning C4005: 'WTS_CONSOLE_CONNECT' : macro redefini
tion
        C:\C\include\WIN.H(7492) : see previous definition of 'WTS_CONSOLE_CONNE
CT'
C:\C\include\WIN.H(8201) : warning C4005: 'WTS_CONSOLE_DISCONNECT' : macro redef
inition
        C:\C\include\WIN.H(7493) : see previous definition of 'WTS_CONSOLE_DISCO
NNECT'
C:\C\include\WIN.H(8202) : warning C4005: 'WTS_REMOTE_CONNECT' : macro redefinit
ion
        C:\C\include\WIN.H(7494) : see previous definition of 'WTS_REMOTE_CONNEC
T'
C:\C\include\WIN.H(8203) : warning C4005: 'WTS_REMOTE_DISCONNECT' : macro redefi
nition
        C:\C\include\WIN.H(7495) : see previous definition of 'WTS_REMOTE_DISCON
NECT'
C:\C\include\WIN.H(8204) : warning C4005: 'WTS_SESSION_LOGON' : macro redefiniti
on
        C:\C\include\WIN.H(7496) : see previous definition of 'WTS_SESSION_LOGON
'
C:\C\include\WIN.H(8205) : warning C4005: 'WTS_SESSION_LOGOFF' : macro redefinit
ion
        C:\C\include\WIN.H(7497) : see previous definition of 'WTS_SESSION_LOGOF
F'
C:\C\include\WIN.H(8206) : warning C4005: 'WTS_SESSION_LOCK' : macro redefinitio
n
        C:\C\include\WIN.H(7498) : see previous definition of 'WTS_SESSION_LOCK'

C:\C\include\WIN.H(8207) : warning C4005: 'WTS_SESSION_UNLOCK' : macro redefinit
ion
        C:\C\include\WIN.H(7499) : see previous definition of 'WTS_SESSION_UNLOC
K'
C:\C\include\gl\gl.h(1151) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1152) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1153) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1154) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1155) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1156) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1157) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1158) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1159) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1160) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1161) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1162) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1163) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1164) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1165) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1166) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1167) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1168) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1169) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1170) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1171) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1172) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1173) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1174) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1175) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1176) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1177) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1178) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1179) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1180) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1181) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1182) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1183) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1184) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1185) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1186) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1187) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1188) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1189) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1190) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1191) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1192) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1193) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1194) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1195) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1196) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1197) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1198) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1199) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1200) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1201) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1202) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1203) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1204) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1205) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1206) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1207) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1208) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1209) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1210) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1211) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1212) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1213) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1214) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1215) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1216) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1217) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1218) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1219) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1220) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1221) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1222) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1223) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1224) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1225) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1226) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1227) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1228) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1229) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1230) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1231) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1232) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1233) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1234) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1235) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1236) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1237) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1238) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1239) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1240) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1241) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1242) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1243) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1244) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1245) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1246) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1247) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1248) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1249) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1250) : error C2059: syntax error : 'type'
C:\C\include\gl\gl.h(1250) : fatal error C1003: error count exceeds 100; stoppin
g compilation

So... what was I supposed to do that I didn't do?
Noobwaker is offline   Reply With Quote
Old 03-10-2006, 09:01 PM   #2
erstwhile
 
Join Date: Jan 2002
Posts: 2,223
>>WIN.H<<

That looks like an lcc specific header. Try #include <windows.h> instead, it should sort out all those 'type' issue with the opengl headers too. You'll need the platform sdk installed, if you haven't already done so.
__________________
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
Ken Fitlike is offline   Reply With Quote
Old 03-10-2006, 11:03 PM   #3
Registered User
 
Join Date: Mar 2006
Posts: 21
Oh... thanks.


Ok, I think I fixed the windows.h problem, but now I'm having other problems with the gl header. I'm getting a bunch of these errors:
Code:
gl\gl.h(1151) : error C2054: expected '(' to follow 'WINGDIAPI'
gl\gl.h(1151) : error C2085: 'APIENTRY' : not in formal parameter list
gl\gl.h(1151) : error C2146: syntax error : missing ',' before identifier 'glAccum'
gl\gl.h(1151) : error C2143: syntax error : missing ';' before '('
gl\gl.h(1151) : error C2059: syntax error : ')'
gl\gl.h(1152) : error C2054: expected '(' to follow'WINGDIAPI'
gl\gl.h(1152) : error C2085: 'APIENTRY' : not in formal parameter list
gl\gl.h(1152) : error C2146: syntax error : missing ',' before identifier 'glAlphaFunc'
gl\gl.h(1152) : error C2143: syntax error : missing ';' before '('
gl\gl.h(1152) : error C2059: syntax error : ')'
gl\gl.h(1153) : error C2054: expected '(' to follow 'WINGDIAPI'
Do I need the SDK for this? What is it exactly? I don't really want to install it unless I really need to.

Last edited by Noobwaker; 03-10-2006 at 11:17 PM.
Noobwaker is offline   Reply With Quote
Old 03-10-2006, 11:50 PM   #4
Even death may die...
 
Dante Shamest's Avatar
 
Join Date: Apr 2003
Location: Malaysia
Posts: 970
The Platform SDK includes the Win32 and OpenGL libraries. The Platform SDK also contains many other things for Win32 development. The following page has more information.

Using Visual C++ 2005 Express Edition with the Microsoft Platform SDK

I usually suggest to people to try MinGW first. It comes bundled with the following two C++ IDEs, and they also include template OpenGL projects.
Dante Shamest is offline   Reply With Quote
Old 03-11-2006, 12:45 AM   #5
chococoder
 
Join Date: Nov 2004
Posts: 443
starting out with a real compiler that's used in the real world is better than starting with a toy that no potential future employer will ever use...

The extra time needed to set up Microsoft's (or Borland's) free compilers is the price you pay for getting them free (the complete products do all that for you as well as including more options).
jwenting is offline   Reply With Quote
Old 03-11-2006, 02:46 PM   #6
Registered User
 
Join Date: Mar 2006
Posts: 21
Ok, thanks.
All the header errors are gone. Now it just doesn't like my source code.

errors:
Code:
oRly.c
oRly.c(154) : error C2143: syntax error : missing ';' before 'type'
oRly.c(174) : error C2065: 'pfd' : undeclared identifier
oRly.c(174) : warning C4133: 'function' : incompatible types - from 'int *
' to 'const PIXELFORMATDESCRIPTOR *'
oRly.c(179) : warning C4133: 'function' : incompatible types - from 'int *
' to 'const PIXELFORMATDESCRIPTOR *'
oRly.c(197) : error C2275: 'MSG' : illegal use of this type as an expression
        C:\Documents and Settings\WhyMe\My Documents\VC++\include\WinUser.h(1581
) : see declaration of 'MSG'
oRly.c(197) : error C2146: syntax error : missing ';' before identifier 'msg'
oRly.c(197) : error C2144: syntax error : '<Unknown>' should be preceded by '<Un
known>'
oRly.c(197) : error C2144: syntax error : '<Unknown>' should be preceded by '<Un
known>'
oRly.c(197) : error C2143: syntax error : missing ';' before 'identifier'
oRly.c(197) : error C2065: 'msg' : undeclared identifier
oRly.c(198) : error C2143: syntax error : missing ';' before 'type'
oRly.c(202) : error C2065: 'done' : undeclared identifier
oRly.c(203) : warning C4133: 'function' : incompatible types - from 'int *' to '
LPMSG'
oRly.c(204) : error C2224: left of '.message' must have struct/union type
oRly.c(208) : warning C4133: 'function' : incompatible types - from 'int *' to '
const MSG *'
oRly.c(209) : warning C4133: 'function' : incompatible types - from 'int *' to '
const MSG *'
oRly.c(227) : error C2224: left of '.wParam' must have struct/union type
oRly.c(227) : warning C4033: 'WinMain' must return a value
Code:
short MakeWind(void){
	int			PixelFormat;
	WNDCLASS	wc;
	DWORD		dwExStyle, dwStyle;
	RECT 		WindRect;
	WindRect.left=(long)0;
	WindRect.right=(long)windW;
	WindRect.top=(long)0;
	WindRect.bottom=(long)windH;
	hInst = GetModuleHandle(NULL);
	wc.style = CS_OWNDC;
	wc.lpfnWndProc = (WNDPROC) WndProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = hInst;
	wc.hIcon = LoadIcon(NULL, NULL);
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = NULL;
	wc.lpszMenuName = NULL;
	wc.lpszClassName = className;
	if (!RegisterClass(&wc)){
		MessageBox(NULL,"Unable to RegisterClass","Oh Noes!",MB_OK|MB_ICONEXCLAMATION);
		return 0;
	}
	dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
	dwStyle=WS_OVERLAPPEDWINDOW;
	AdjustWindowRectEx(&WindRect, dwStyle, FALSE, dwExStyle);
	if (!(hWnd=CreateWindowEx(dwExStyle,
					className,
					windTitle,
					WS_CLIPSIBLINGS |
					WS_CLIPCHILDREN |
					dwStyle,
					0, 0,
					WindRect.right-WindRect.left,
					WindRect.bottom-WindRect.top,
					NULL,
					NULL,
					hInst,
					NULL))){
		DestroyWind();
		MessageBox(NULL,"Unable to Make Window","...",MB_OK|MB_ICONEXCLAMATION);
		return 0;
	}
	static	PIXELFORMATDESCRIPTOR pfd={ //Line 154
		sizeof(PIXELFORMATDESCRIPTOR),
		1,
		PFD_DRAW_TO_WINDOW |
		PFD_SUPPORT_OPENGL |
		PFD_DOUBLEBUFFER,
		PFD_TYPE_RGBA,
		16,					//Color Depth
		0, 0, 0, 0, 0, 0,	//Color Bits
		0,					//Alpha Buffer
		0,					//Shift Bit
		0,					//Accumulation Buffer
		0, 0, 0, 0,			//Accumulation Bits
		16,					//Depth Buffer
		0,					//Stencil Buffer
		0,					//Auxiliary Buffer
		PFD_MAIN_PLANE,
		0,
		0, 0, 0				/*Layer Masks*/};
	hDC=GetDC(hWnd);
	if(!(PixelFormat=ChoosePixelFormat(hDC,&pfd))){
		DestroyWind();
		MessageBox(NULL,"Unable to Find a PixelFormat","Pixels are Good",MB_OK|MB_ICONEXCLAMATION);
		return 0;
	}
	if(!SetPixelFormat(hDC,PixelFormat,&pfd)){
		DestroyWind();
		MessageBox(NULL,"Unable to Set PixelFormat","Grr...",MB_OK|MB_ICONEXCLAMATION);
		return 0;
	}
	hRC=wglCreateContext(hDC);
	wglMakeCurrent(hDC,hRC);
	ShowWindow(hWnd,SW_SHOW);
	SetForegroundWindow(hWnd);
	SetFocus(hWnd);
	GLSetup();
	return 1;
}

int WINAPI WinMain(HINSTANCE hInst,	HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow){
	srand(time(NULL)); //Line 194
	rand();
	timer1=clock()-FPSVal/2;
	MSG	msg;
	short done=0;
	if (!MakeWind()){
		return 0;
	}
	while(!done){
		if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)){
			if (msg.message==WM_QUIT){
				done=1;
			}
			else{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
		else{
			if (GetAsyncKeyState(27)!=0){//Esc
				done=1;
			}
			else{
				if((clock()-timer1)>FPSVal){
					timer1=timer1+FPSVal;
					GLDraw();
					SwapBuffers(hDC);
				}
				sleep(1);
			}
		}
	}
	DestroyWind();
	return (msg.wParam);
}

Last edited by Noobwaker; 03-11-2006 at 02:50 PM.
Noobwaker is offline   Reply With Quote
Old 03-11-2006, 04:34 PM   #7
Yes, my avatar is stolen
 
anonytmouse's Avatar
 
Join Date: Dec 2002
Posts: 2,544
In C89, which is the language supported by VC, all variables must be declared at the top of the block.
Code:
int main(...)
{
    int i;
    long l;

    i = 10;

    char c; // error, all declarations must be before the first statement...
}
Variables can be declared in the middle of a block in C99 (which is largely supported by GCC) or C++.

I also suggest that you consider getting Dev-C++ as a second compiler. It is a good idea to have a couple of compilers so that you can produce portable code. A second compiler will also often show up extra warnings and bugs. GCC (as used by Dev-C++) is not a 'toy compiler'. Our communication here is made possible with several pieces of software compiled with GCC.
anonytmouse is offline   Reply With Quote
Old 03-11-2006, 06:13 PM   #8
Registered User
 
Join Date: Mar 2006
Posts: 21
Oh, thanks. I had no idea.

Well, now it doesn't give me any errors, but it doesn't compile either. It just kinda sits there, as if the compiler had an infinite loop in it. Or does VC just take an extremely long time to compile?


Also, how do you change the text under the username?
Noobwaker is offline   Reply With Quote
Old 03-13-2006, 07:33 AM   #9
Registered User
 
Join Date: Mar 2006
Posts: 21
So does anyone know why the compiler would freeze?
Noobwaker is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VC++ Toolkit 2003 download link was removed? dxfoo General Discussions 3 09-05-2006 10:50 PM
declaring arrays with visual C++ toolkit 2003 Rune Hunter C++ Programming 17 11-03-2005 06:27 PM
Need tutorial to use msxml parser with MS Toolkit 2003 Joelito Windows Programming 2 06-24-2005 01:50 PM
File IO with .Net SDK and platform SDK AtomRiot Windows Programming 5 12-14-2004 10:18 AM
FILES in WinAPI Garfield Windows Programming 46 10-02-2003 06:51 PM


All times are GMT -6. The time now is 09:28 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22