470,591 Members | 1,448 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

issue with #include

Hi,

Under VC++.NET, i have a stupid issue with #include statement.
Usually when we include some *.h file, we need to declare them before
any #using <or #using namespace... to avoid issue at compilation time.

However, when i write #include "commctrl.h" as below in my *.h file :

#pragma once
#include "commctrl.h"
#using <mscorlib.dll>

using namespace System;
using namespace System::Windows::Forms;
using namespace System::Drawing;
using namespace System::ComponentModel;
....

i have a lot of errors like :
D:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\commctrl.h(29) : error C2146: syntax error :
missing ';' before identifier 'HRESULT'
D:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\commctrl.h(29) : error C4430: missing type
specifier - int assumed. Note: C++ does not support default-int
and so on...

so now, where the problem ?

thanks a lot,
Al.
Oct 31 '06 #1
1 1566
Additional information :

I did the following thing in my *.h file :

#pragma once
#include <windows.h>
#include "commctrl.h"
#using <mscorlib.dll>
....
LRESULT hWnd;
hWnd = ::SendMessage((HWND)(this->Handle.ToPointer()), LVM_GETHEADER, 0, 0);

but the linker tells :
RAF_ListView.obj : error LNK2028: unresolved token (0A00004B) "extern
"C" long __stdcall SendMessageW(struct HWND__ *,unsigned int,unsigned
int,long)" (?SendMessageW@@$$J216YGJPAUHWND__@@IIJ@Z) referenced in
function "extern "C" long __cdecl SendMessage(struct HWND__ *,unsigned
int,unsigned int,long)" (?SendMessage@@$$J0YAJPAUHWND__@@IIJ@Z)

and

RAF_ListView.obj : error LNK2019: unresolved external symbol "extern "C"
long __stdcall SendMessageW(struct HWND__ *,unsigned int,unsigned
int,long)" (?SendMessageW@@$$J216YGJPAUHWND__@@IIJ@Z) referenced in
function "extern "C" long __cdecl SendMessage(struct HWND__ *,unsigned
int,unsigned int,long)" (?SendMessage@@$$J0YAJPAUHWND__@@IIJ@Z)

except the stdcall changed by cdecl in the error message, everything is
the same...

where is the problem ?

Al.

--== Alain ==-- wrote:
Hi,

Under VC++.NET, i have a stupid issue with #include statement.
Usually when we include some *.h file, we need to declare them before
any #using <or #using namespace... to avoid issue at compilation time.
>
However, when i write #include "commctrl.h" as below in my *.h file :

#pragma once
#include "commctrl.h"
#using <mscorlib.dll>

using namespace System;
using namespace System::Windows::Forms;
using namespace System::Drawing;
using namespace System::ComponentModel;
...

i have a lot of errors like :
D:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\commctrl.h(29) : error C2146: syntax error :
missing ';' before identifier 'HRESULT'
D:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\commctrl.h(29) : error C4430: missing type
specifier - int assumed. Note: C++ does not support default-int
and so on...

so now, where the problem ?

thanks a lot,
Al.
Oct 31 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Ryan Liu | last post: by
7 posts views Thread by Prashant | last post: by
2 posts views Thread by David Arden Stevensonn | last post: by
2 posts views Thread by --== Alain ==-- | last post: by
13 posts views Thread by Howard Hinnant | last post: by
2 posts views Thread by Pedro Pinto | last post: by
10 posts views Thread by Schraalhans Keukenmeester | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.