I have been trying to get the following test program to at least compile and find out where I'm getting my memory addressing problems wrong in the main program. Here is my code:
Code:
#include <iostream>
#include <windows.h>
BOOL somefunc(const WCHAR* filepath,
const wstring* Additions,
DWORD AdditionsSize);
int main()
{
const wstring additions[] = {L"black.dll",
L"white.dll",
L"yellow.dll"};
BOOL ok = somefunc(L"E:\\somepath", additions, sizeof(additions)/sizeof(wstring));
return 0;
}
BOOL somefunc(const WCHAR* filepath,
const wstring* Additions,
DWORD AdditionsSize)
{
for (DWORD i = 0; i < AdditionsSize; ++i)
{
wcout << Additions[i] << endl;
}
return TRUE;
}
However, I'm getting the following compiler error with regards to the types in Visual Studio 2005:
Code:
1>------ Build started: Project: ptrtoptr, Configuration: Debug Win32 ------
1>Compiling...
1>ptrtoptrmain.cpp
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(5) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(5) : error C2146: syntax error : missing ',' before identifier 'Additions'
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(10) : error C2146: syntax error : missing ';' before identifier 'additions'
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(10) : error C2065: 'additions' : undeclared identifier
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(10) : error C2059: syntax error : ']'
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(10) : error C2143: syntax error : missing ';' before '{'
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(12) : error C2143: syntax error : missing ';' before '}'
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(13) : error C2070: ''unknown-type'': illegal sizeof operand
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(19) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(19) : error C2146: syntax error : missing ',' before identifier 'Additions'
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(22) : error C2065: 'AdditionsSize' : undeclared identifier
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(24) : error C2065: 'wcout' : undeclared identifier
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(24) : error C2065: 'Additions' : undeclared identifier
1>e:\test\ptrtoptr\ptrtoptrmain.cpp(24) : error C2065: 'endl' : undeclared identifier
1>Build log was saved at "file://e:\test\ptrtoptr\Debug\BuildLog.htm"
1>ptrtoptr - 15 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Is there a header file that I have missed that could cause this to happen?