|
|
Visual C++ Express Edition |
|
| Author |
Message |
|
cantara
Joined: 19 Jul 2006 Posts: 53
|
Posted: Sun Oct 15, 2006 10:46 pm Post subject: Visual C++ Express Edition |
|
|
does anyone know how to link files with the Visual C++ Express Edition compiler?
|
|
|
| Back to top |
|
|
battagline Site Admin

Joined: 04 Jul 2005 Posts: 780 Location: Morrison, CO (USA)
|
Posted: Sun Oct 15, 2006 10:58 pm Post subject: |
|
|
Is it different than the normal version of Visual C++?
|
|
|
| Back to top |
|
|
omagaalpha

Joined: 07 Aug 2005 Posts: 303
|
Posted: Mon Oct 16, 2006 6:45 pm Post subject: |
|
|
here whole program that free link [url]http://msdn.microsoft.com/vstudio/express/visualc/download/default.aspx[/url]
|
|
|
| Back to top |
|
|
cantara
Joined: 19 Jul 2006 Posts: 53
|
Posted: Tue Oct 17, 2006 11:30 pm Post subject: |
|
|
thanks, i figured it out. I have a different problem now, though. The compiler is telling me i have like 75 syntax errors in places i KNOW i don't. Could anyone please tell me what i am doing wrong? here is my source code and the compile log:
source code:
IDirect3D9 *d3d = NULL;
IDirect3DDevice9 *d3ddevice = NULL;
HINSTANCE globinsthandle;
HWND globwinhandle;
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdShow);
long FAR PASCAL WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
void frame();
void initilization();
void shutdown();
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdShow)
{
MSG message;
globinsthandle = hInst;
WNDCLASSEX windowclass;
windowclass.cbSize = sizeof(windowclass);
windowclass.style = CS_CLASSDC;
windowclass.lpfnWndProc = WindowProc;
windowclass.cbClsExtra = 0;
windowclass.cbWndExtra = 0;
windowclass.hInstance = hInst;
windowclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
windowclass.hCursor = LoadCursor(NULL, IDC_ARROW);
windowclass.hbrBackground = NULL;
windowclass.lpszMenuName = NULL;
windowclass.lpszClassName = "game";
windowclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
RegisterClassEx(&windowclass);
HWND handletomainwindow;
handletomainwindow = CreateWindow("game", "caption1", WS_OVERLAPPEDWINDOW, 0, 0, 1600, 1200, NULL, NULL, hInst, NULL);
ShowWindow(handletomainwindow, SW_NORMAL);
UpdateWindow(handletomainwindow);
initilization();
ZeroMemory(&message, sizeof(message));
while(message.message != WM_QUIT)
{
if(PeekMessage(&message, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&message);
DispatchMessage(&message);
}
else
frame();
}
shutdown();
UnregisterClass("game", hInst);
return 0;
}
void frame()
{
/* still need to set up matrices here
I didn't in the initilization because we will need to change them depending on
what is happening in the game at any given time
*/
return;
}
void initilization()
{
D3DPRESENT_PARAMETERS d3dpresparam;
D3DDISPLAYMODE d3ddisplaymode;
d3d = Direct3DCreate9(D3D_SDK_VERSION);
d3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddisplaymode);
ZeroMemory(&d3dpresparam, sizeof(d3dpresparam));
d3dpresparam.Windowed = TRUE;
d3dpresparam.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpresparam.BackBufferFormat = d3ddisplaymode.Format;
d3dpresparam.EnableAutoDepthStencil = TRUE;
d3dpresparam.AutoDepthStencilFormat = D3DFMT_D16;
d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, globwinhandle, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpresparam, &d3ddevice);
d3ddevice->SetRenderState(D3DRS_LIGHTING, TRUE);
d3ddevice->SetRenderState(D3DRS_ZENABLE, TRUE);
return;
}
void shutdown()
{
d3ddevice->Release();
d3d->Release();
return;
}
long FAR PASCAL WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
please note that i delete about 17 lines of comments at the beginning, so it says the first error is on line 18, but it's really on the first line.
here is the compile log:
1>Compiling...
1>framework.cpp
1>..\..\framework.cpp(1 : error C2143: syntax error : missing ';' before '*'
1>..\..\framework.cpp(1 : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(1 : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(1 : error C2065: 'NULL' : undeclared identifier
1>..\..\framework.cpp(19) : error C2143: syntax error : missing ';' before '*'
1>..\..\framework.cpp(19) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(19) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(20) : error C2146: syntax error : missing ';' before identifier 'globinsthandle'
1>..\..\framework.cpp(20) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(20) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(21) : error C2146: syntax error : missing ';' before identifier 'globwinhandle'
1>..\..\framework.cpp(21) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(21) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(22) : error C2146: syntax error : missing ';' before identifier 'WinMain'
1>..\..\framework.cpp(22) : error C2146: syntax error : missing ')' before identifier 'hInst'
1>..\..\framework.cpp(22) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(22) : error C2059: syntax error : ')'
1>..\..\framework.cpp(23) : error C2146: syntax error : missing ';' before identifier 'PASCAL'
1>..\..\framework.cpp(23) : error C2146: syntax error : missing ';' before identifier 'WindowProc'
1>..\..\framework.cpp(23) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(23) : error C2086: 'int PASCAL' : redefinition
1> ..\..\framework.cpp(22) : see declaration of 'PASCAL'
1>..\..\framework.cpp(23) : error C2146: syntax error : missing ')' before identifier 'hWnd'
1>..\..\framework.cpp(23) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(23) : error C2059: syntax error : ')'
1>..\..\framework.cpp(27) : error C2146: syntax error : missing ';' before identifier 'WinMain'
1>..\..\framework.cpp(27) : error C2086: 'int PASCAL' : redefinition
1> ..\..\framework.cpp(22) : see declaration of 'PASCAL'
1>..\..\framework.cpp(27) : error C2146: syntax error : missing ')' before identifier 'hInst'
1>..\..\framework.cpp(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(27) : error C2374: 'WinMain' : redefinition; multiple initialization
1> ..\..\framework.cpp(22) : see declaration of 'WinMain'
1>..\..\framework.cpp(27) : error C2059: syntax error : ')'
1>..\..\framework.cpp(2 : error C2143: syntax error : missing ';' before '{'
1>..\..\framework.cpp(2 : error C2447: '{' : missing function header (old-style formal list?)
1>..\..\framework.cpp(75) : error C2065: 'D3DPRESENT_PARAMETERS' : undeclared identifier
1>..\..\framework.cpp(75) : error C2146: syntax error : missing ';' before identifier 'd3dpresparam'
1>..\..\framework.cpp(75) : error C2065: 'd3dpresparam' : undeclared identifier
1>..\..\framework.cpp(76) : error C2065: 'D3DDISPLAYMODE' : undeclared identifier
1>..\..\framework.cpp(76) : error C2146: syntax error : missing ';' before identifier 'd3ddisplaymode'
1>..\..\framework.cpp(76) : error C2065: 'd3ddisplaymode' : undeclared identifier
1>..\..\framework.cpp(77) : error C2065: 'D3D_SDK_VERSION' : undeclared identifier
1>..\..\framework.cpp(77) : error C3861: 'Direct3DCreate9': identifier not found
1>..\..\framework.cpp(7 : error C2227: left of '->GetAdapterDisplayMode' must point to class/struct/union/generic type
1> type is 'int *'
1>..\..\framework.cpp(7 : error C2065: 'D3DADAPTER_DEFAULT' : undeclared identifier
1>..\..\framework.cpp(79) : error C2070: ''unknown-type'': illegal sizeof operand
1>..\..\framework.cpp(79) : error C3861: 'ZeroMemory': identifier not found
1>..\..\framework.cpp(80) : error C2228: left of '.Windowed' must have class/struct/union
1> type is ''unknown-type''
1>..\..\framework.cpp(80) : error C2065: 'TRUE' : undeclared identifier
1>..\..\framework.cpp(81) : error C2228: left of '.SwapEffect' must have class/struct/union
1> type is ''unknown-type''
1>..\..\framework.cpp(81) : error C2065: 'D3DSWAPEFFECT_DISCARD' : undeclared identifier
1>..\..\framework.cpp(82) : error C2228: left of '.BackBufferFormat' must have class/struct/union
1> type is ''unknown-type''
1>..\..\framework.cpp(82) : error C2228: left of '.Format' must have class/struct/union
1> type is ''unknown-type''
1>..\..\framework.cpp(83) : error C2228: left of '.EnableAutoDepthStencil' must have class/struct/union
1> type is ''unknown-type''
1>..\..\framework.cpp(84) : error C2228: left of '.AutoDepthStencilFormat' must have class/struct/union
1> type is ''unknown-type''
1>..\..\framework.cpp(84) : error C2065: 'D3DFMT_D16' : undeclared identifier
1>..\..\framework.cpp(85) : error C2227: left of '->CreateDevice' must point to class/struct/union/generic type
1> type is 'int *'
1>..\..\framework.cpp(85) : error C2065: 'D3DDEVTYPE_HAL' : undeclared identifier
1>..\..\framework.cpp(85) : error C2065: 'D3DCREATE_SOFTWARE_VERTEXPROCESSING' : undeclared identifier
1>..\..\framework.cpp(86) : error C2227: left of '->SetRenderState' must point to class/struct/union/generic type
1> type is 'int *'
1>..\..\framework.cpp(86) : error C2065: 'D3DRS_LIGHTING' : undeclared identifier
1>..\..\framework.cpp(87) : error C2227: left of '->SetRenderState' must point to class/struct/union/generic type
1> type is 'int *'
1>..\..\framework.cpp(87) : error C2065: 'D3DRS_ZENABLE' : undeclared identifier
1>..\..\framework.cpp(92) : error C2227: left of '->Release' must point to class/struct/union/generic type
1> type is 'int *'
1>..\..\framework.cpp(93) : error C2227: left of '->Release' must point to class/struct/union/generic type
1> type is 'int *'
1>..\..\framework.cpp(97) : error C2146: syntax error : missing ';' before identifier 'PASCAL'
1>..\..\framework.cpp(97) : error C2086: 'long FAR' : redefinition
1> ..\..\framework.cpp(23) : see declaration of 'FAR'
1>..\..\framework.cpp(97) : error C2146: syntax error : missing ';' before identifier 'WindowProc'
1>..\..\framework.cpp(97) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(97) : error C2086: 'int PASCAL' : redefinition
1> ..\..\framework.cpp(22) : see declaration of 'PASCAL'
1>..\..\framework.cpp(97) : error C2146: syntax error : missing ')' before identifier 'hWnd'
1>..\..\framework.cpp(97) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\..\framework.cpp(97) : error C2374: 'WindowProc' : redefinition; multiple initialization
1> ..\..\framework.cpp(23) : see declaration of 'WindowProc'
1>..\..\framework.cpp(97) : error C2059: syntax error : ')'
1>..\..\framework.cpp(9 : error C2143: syntax error : missing ';' before '{'
1>..\..\framework.cpp(9 : error C2447: '{' : missing function header (old-style formal list?)
please help me, this is getting really annoying. sorry for my absence by the way.
|
|
|
| Back to top |
|
|
omagaalpha

Joined: 07 Aug 2005 Posts: 303
|
Posted: Wed Oct 18, 2006 1:44 am Post subject: |
|
|
direct3d is not initalize in project file you have so does not recongize it prameter as class that you defined
|
|
|
| Back to top |
|
|
cantara
Joined: 19 Jul 2006 Posts: 53
|
Posted: Wed Oct 18, 2006 6:23 pm Post subject: |
|
|
I physically included it in the project file so there is no link.
|
|
|
| Back to top |
|
|
omagaalpha

Joined: 07 Aug 2005 Posts: 303
|
Posted: Wed Oct 18, 2006 9:08 pm Post subject: |
|
|
so did include directx in reference part. other then that I don't know what could be.
|
|
|
| Back to top |
|
|
ghell
Joined: 28 Apr 2006 Posts: 130
|
Posted: Fri Oct 20, 2006 1:17 pm Post subject: |
|
|
Once you have DirectX 9 SDK installed:
Add the DirectX\include directory to your include path (so that it can find the headers) and put #include <d3d9.h> at the top of your file.
This will fix errors such as "error C2065: 'D3DPRESENT_PARAMETERS' : undeclared identifier"
Also make sure you have the directx sdk\lib directory in your lib path.
Then for each project you make add d3d9.lib and d3dx9.lib (d3dx9d.lib for debugging) to your linker list.
When I get home I will take some screenshots or something (and maybe a small sample project though I have the full VS2005 Pro so i'm not 100% sure if they are compatible) of what you need if its still unclear.
You may also need the MS Platform SDK installed at some point im not sure.
Microsoft Visual C++ Express 2005 isn't that great for writing unmanagd C++ I find. It's mainly aimed at Managed C++ for the .NET Framework I think... but you should be able to set it up to do this normally I'm sure.
|
|
|
| Back to top |
|
|
cantara
Joined: 19 Jul 2006 Posts: 53
|
Posted: Fri Oct 20, 2006 4:23 pm Post subject: |
|
|
thanks.
|
|
|
| Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|