Ive just recently switched to visual studio c++ express.

I am Creating some shapes with dx9 and i came upon this problem with my indices:
error C2064: term does not evaluate to a function taking 24 arguments

here is the code where i am getting the error:

short indices[100];

    indices[100]
	(
        0,1,2,
        2,1,3,
        4,5,6,
        6,5,7,
        8,9,10,
        10,9,11,
        12,13,14,
        14,13,15
     );

I'm not 100% sure why you are making a 100 element array to hold 24 indices. Also you are trying to treat an array like a function or something, but it is incorrect.

There are a few ways of doing this but here is the way I think you would want it

short indices[] =
{
        0,1,2,
        2,1,3,
        4,5,6,
        6,5,7,
        8,9,10,
        10,9,11,
        12,13,14,
        14,13,15
};

I was using a 100 array becuase i was trying to fix the problem.

using the code that you gave me i now get loads of errors??

error LNK2019: unresolved external symbol __imp__DispatchMessageW@4 referenced in function _WinMain@16
error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _WinMain@16
error LNK2019: unresolved external symbol __imp__PeekMessageW@20 referenced in function _WinMain@16
error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function _WinMain@16
error LNK2019: unresolved external symbol __imp__CreateWindowExW@48 referenced in function _WinMain@16
Input Test.obj : error LNK2019: unresolved external symbol __imp__RegisterClassExW@4 referenced in function _WinMain@16
error LNK2019: unresolved external symbol __imp__LoadCursorW@8 referenced in function _WinMain@16
error LNK2019: unresolved external symbol __imp__DefWindowProcW@16 referenced in function "long __stdcall WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProc@@YGJPAUHWND__@@IIJ@Z)
error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall WindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProc@@YGJPAUHWND__@@IIJ@Z)
error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "void __cdecl initD3D(struct HWND__ *)" (?initD3D@@YAXPAUHWND__@@@Z)
error LNK2019: unresolved external symbol _D3DXMatrixRotationY@8 referenced in function "void __cdecl render_frame(void)" (?render_frame@@YAXXZ)
error LNK2019: unresolved external symbol _D3DXMatrixPerspectiveFovLH@20 referenced in function "void __cdecl render_frame(void)" (?render_frame@@YAXXZ)
: error LNK2019: unresolved external symbol _D3DXMatrixLookAtLH@16 referenced in function "void __cdecl render_frame(void)" (?render_frame@@YAXXZ)
error LNK2001: unresolved external symbol _c_dfDIMouse
error LNK2001: unresolved external symbol _c_dfDIKeyboard
error LNK2001: unresolved external symbol _GUID_SysMouse
error LNK2001: unresolved external symbol _GUID_SysKeyboard
error LNK2019: unresolved external symbol _DirectInput8Create@20 referenced in function "void __cdecl initDInput(struct HINSTANCE__ *,struct HWND__ *)" (?initDInput@@YAXPAUHINSTANCE__@@PAUHWND__@@@Z)
error LNK2001: unresolved external symbol _IID_IDirectInput8W
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol __imp__EncodePointer@4 referenced in function _pre_c_init
MSVCRTD.lib(atonexit.obj) : error LNK2001: unresolved external symbol __imp__EncodePointer@4
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol __imp__InterlockedExchange@8 referenced in function ___tmainCRTStartup
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol __imp__Sleep@4 referenced in function ___tmainCRTStartup
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol __imp__InterlockedCompareExchange@12 referenced in function ___tmainCRTStartup
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol __imp__HeapSetInformation@16 referenced in function ___tmainCRTStartup
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol __imp__GetStartupInfoW@4 referenced in function ___tmainCRTStartup
MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp__WideCharToMultiByte@32 referenced in function "void __cdecl failwithmessage(void *,int,int,char const *)" (?failwithmessage@@YAXPAXHHPBD@Z)
MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp__IsDebuggerPresent@0 referenced in function "void __cdecl failwithmessage(void *,int,int,char const *)" (?failwithmessage@@YAXPAXHHPBD@Z)
MSVCRTD.lib(gs_report.obj) : error LNK2001: unresolved external symbol __imp__IsDebuggerPresent@0
MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp__MultiByteToWideChar@24 referenced in function "void __cdecl failwithmessage(void *,int,int,char const *)" (?failwithmessage@@YAXPAXHHPBD@Z)
MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp__RaiseException@16 referenced in function "int __cdecl DebuggerProbe(unsigned long)" (?DebuggerProbe@@YAHK@Z)
MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp__lstrlenA@4 referenced in function "void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)" (?_RTC_AllocaFailure@@YAXPAXPAU_RTC_ALLOCA_NODE@@H@Z)
MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp__GetProcAddress@8 referenced in function "void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)" (?_RTC_AllocaFailure@@YAXPAXPAU_RTC_ALLOCA_NODE@@H@Z)
MSVCRTD.lib(_pdblkup_.obj) : error LNK2001: unresolved external symbol __imp__GetProcAddress@8
MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp__LoadLibraryW@4 referenced in function "void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)" (?_RTC_AllocaFailure@@YAXPAXPAU_RTC_ALLOCA_NODE@@H@Z)
MSVCRTD.lib(_pdblkup_.obj) : error LNK2001: unresolved external symbol __imp__LoadLibraryW@4
MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp__TerminateProcess@8 referenced in function ___report_gsfailure
MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp__GetCurrentProcess@0 referenced in function ___report_gsfailure
MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp__UnhandledExceptionFilter@4 referenced in function ___report_gsfailure
MSVCRTD.lib(gs_report.obj) : error LNK2019: unresolved external symbol __imp__SetUnhandledExceptionFilter@4 referenced in function ___report_gsfailure
MSVCRTD.lib(unhandld.obj) : error LNK2001: unresolved external symbol __imp__SetUnhandledExceptionFilter@4
MSVCRTD.lib(atonexit.obj) : error LNK2019: unresolved external symbol __imp__DecodePointer@4 referenced in function __onexit
MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp__QueryPerformanceCounter@4 referenced in function ___security_init_cookie
MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp__GetTickCount@0 referenced in function ___security_init_cookie
MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp__GetCurrentThreadId@0 referenced in function ___security_init_cookie
MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp__GetCurrentProcessId@0 referenced in function ___security_init_cookie
MSVCRTD.lib(gs_support.obj) : error LNK2019: unresolved external symbol __imp__GetSystemTimeAsFileTime@4 referenced in function ___security_init_cookie
MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __imp__HeapFree@12 referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z)
MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __imp__HeapAlloc@12 referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z)
MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __imp__GetProcessHeap@0 referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z)
MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __imp__GetModuleFileNameW@12 referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z)
MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __imp__VirtualQuery@12 referenced in function "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z)
MSVCRTD.lib(_pdblkup_.obj) : error LNK2019: unresolved external symbol __imp__FreeLibrary@4 referenced in function "struct HINSTANCE__ * __cdecl GetPdbDll(void)" (?GetPdbDll@@YAPAUHINSTANCE__@@XZ)

If I had to guess I'd say that you haven't linked any libraries to your project and when you fixed that one error it found even more, so it didn't break your program it just showed you the other bunch of errors you have.

To link the libraries to your project go to 'Project > "ProjectName" Properties...', expand 'Configuration Properties', expand 'Linker' and select 'Input'. Under 'Additional Dependencies' you should have nothing but you need some of the default windows ones in order to use the functions above. By default if you make a Win32 console or window project you should have 'kernel32.lib, user32.lib, gdi32.lib, winspool.lib, comdlg32.lib, advapi32.lib, shell32.lib, ole32.lib, oleaut32.lib, uuid.lib, odbc32.lib, odbccp32.lib', however you should only need the first three listed to operate.

The above libs are for the Windows functions, so you will need to add the ones for DirectX (which I do not know what ones you need since I use OpenGL) and whatever other libraries you are using.

You can also add more search directories for the libraries so you do not need to place them all in the Visual Studio lib folder. This is done by selecting 'General' instead of 'Input' and then selecting 'Additional Library Directories' where you just input the path of the folder containing the lib files you want to use.

Yeah i already have them but dont worry about that. I created a new visual studio project from scratch.

I've got a few problems with them so far and most of them are with syntax such as: error C2143: syntax error : missing ';' before ',' << any idea how to fix them?

also with a part of my new code:

HWND hWnd = CreateWindow( WINDOW_TITLE, WINDOW_TITLE, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, WINDOW_WIDTH,
WINDOW_HEIGHT, 0, 0, hInstance, 0 );

i am getting the error: error C2660: 'CreateWindowExW' : function does not take 2 arguments

i am totally lost on this one as i have looked around the MSDN used almost the same code as them and i still get the error?

You will have to show a lot more source code than that if you want a real answer.

What type is WINDOW_TITLE? All of those syntax errors could be caused by anything, especially after looking at how you were trying to assign an array from before.

Thats all fixed now but now i keep getting the same errors as before

im getting errors like this:
error LNK2019: unresolved external symbol __imp__DispatchMessageW@4 referenced in function _WinMain@16
MSVCRTD.lib(_error_.obj) : error LNK2019: unresolved external symbol __imp__GetProcAddress@8 referenced in function "void __cdecl _RTC_AllocaFailure(void *,struct _RTC_ALLOCA_NODE *,int)" (?_RTC_AllocaFailure@@YAXPAXPAU_RTC_ALLOCA_NODE@@H@Z)

and just loads of them.

here is my source code

#include <Windows.h>

#define WINDOW_HEIGHT 640;
#define WINDOW_WIDTH 480;

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance , LPSTR cmdLine, int cmdShow )
{
	HWND hWnd;  // handle for the window

	//define the window
	WNDCLASSEX wcex;
	wcex.cbSize = sizeof(WNDCLASSEX);
	wcex.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
	wcex.lpfnWndProc = WndProc;
	wcex.cbClsExtra = 0;
	wcex.cbWndExtra = 0;
	wcex.hInstance = hInstance;
	wcex.hIcon = NULL;
	wcex.hCursor = LoadCursor( hInstance, IDC_ARROW );
	wcex.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH );
	wcex.lpszMenuName = NULL;
	wcex.lpszClassName = L"WindowClass1";

	//register the window class
	RegisterClassEx(&wcex);

	//create the window
	hWnd = CreateWindowEx( NULL, L"WindowClass1", L"Input Test", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, WINDOW_WIDTH, WINDOW_HEIGHT, NULL, NULL, hInstance, NULL ); 


	ShowWindow ( hWnd, cmdShow ); 

	// main loop
	
	MSG msg;

	while(1)
	{
		//only render when there are no messages 
		if ( PeekMessage (&msg, NULL, 0, 0, PM_REMOVE) )
		{
			if ( msg.message == WM_QUIT)
			{
				break;
			}
		    TranslateMessage(&msg);
		    DispatchMessage(&msg);
		}

		else
		{
			// render a frame
		}
	}

	return 0;
}

LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{

	case WM_DESTROY:
	  PostQuitMessage(0);
	  return 0;

	case WM_PAINT:

     // render a frame then validate the client area
	  ValidateRect (hWnd, 0);
	  return 0;
		
	}

	return DefWindowProc(hWnd, message, wParam, lParam);
}

You have a problem with the CreateWindowEx() function because your #define statements at the top have semi-colons at the end of them, and they are not supposed to have that. The preprocessor takes your defines and pretty much uses find-replace on your code then processes it. So your CreateWindowEx() would look like

hWnd = CreateWindowEx(NULL, L"WindowClass1", L"Input Test", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 640;, 480;, NULL, NULL, hInstance, NULL);

Notice the ';'s that aren't supposed to be there.

Might be because you do not have the right libraries linked or your settings under 'Project > "ProjectName" Properties... > Configuration Properties > Linker > System > SubSystem' might be set to 'Console' rather than 'Windows'.

Thanks Thats solved the problem with CreateWindowEx, silly me. I've linked all the libraries you have said that i should have and the the subsystem was already set to windows but im still getting most of the errors that i had listed. Most of them seem to be something to do with MSVCRTD.lib

I copied your source code and it runs fine after taking the semi-colons out.

Can you zip up the source files and the .sln, .vcxproj files? It should only be a few KB in size.

what do you want me to do with them?

What should i do with the zip file

If you could zip it and post it here (with manage attachments) then I could open it and see what is wrong.

how do i post it here

edit----

dont worry i found it, ill have to do it later when i get to my PC

here they are and sorry about the double post.

i dont know if it matters but i had to get rid of the.ipch folder to be able to keep it under the size limit?

See attached image

The file that was inside the zip doesn't do anything. I removed all my linked libraries and tested to see what ones I need and don't need and there are three that you need in order to compile the code you posted.

kernel32.lib
user32.lib
gdi32.lib

You can check the box 'Inherit from parent or project defaults' to load in all the libraries in the lower section of the pop up box of the screen shot below.

This is what mine is like but im still getting the same problems?

Can you post a zip of all the files of my source code that you said compiled ok for you?

You can try running what I have zipped up but my last guess as to what might be wrong is the fact that you have msvcrtd.lib and mfcs80ud.lib in 'Ignore Specific Default Libraries'. When I put those in I got errors but not the same ones as you.

The only problem with that is when I take them out of ignore specific libaries I get about 20 more errors starting with msvcrtd.lib

Cheers for your help i managed to get it working in the end

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.