|
I want to use the class CList for my project, but I get the following compiler error as soon as I do #include <afxtempl.h>
Compiling...
snaplogger_main.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
CSnapLogger.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
CDeviceFileParser.cpp
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxv_w32.h(18) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
CCommsManager.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
|
|
|
|
|
piul wrote: Compiling...
snaplogger_main.cpp
WINVER not defined. Defaulting to 0x0501 (Windows XP and Windows .NET Server)
Not a real error, but only an information.
[...]
piul wrote: CDeviceFileParser.cpp
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxv_w32.h(18) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
Do you include Windows.h anywhere explicitly?
How does the stdafx.h of your project look like? Where do you include afxtempl.h?
Regards,
Christoph
|
|
|
|
|
I do not see any stdafx.h in my project. And no, I do not include Windows.h explicitly.
afxtempl.h is included in CDeviceFileParser.h
Any idea of why windows.h is being included? And why should this be a problem??
|
|
|
|
|
What kind of application did you create? Is it a MFC application? Seems so since you intend to use afxtempl.h. Can you please check the the project settings?
Regards,
Christoph
|
|
|
|
|
I am not very sure if it is a MFC application, I did not create it myself.
Project properties says:
Use of MFC : Use Standard Windows Libraries
|
|
|
|
|
Maybe it would be the easiest way to create an empty MFC project and add the files of the Win32 project to that?
Or simply try to change the "Use of MFC" to "Use MFC in a Static library" and rebuild. Don't know if this will work.
Regards,
Christoph
|
|
|
|
|
Oh... I've just found a place where windows.h is included explicitly. What a mess!! I should start tidying all this up first of all...
Thanks!
|
|
|
|
|
You're welcome.
Regards,
Christoph
|
|
|
|
|
piul wrote: I want to use the class CList for my project, but I get the following compiler error as soon as I do #include <afxtempl.h>
Do you have an MFC-based project? If not, you might consider using one of the STL containers instead.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I might be easier if I say what I want to do.
I want to store in a variable a number of strings. The number of them will be variable and not known at the time of declaring the list/array/whatever.
For what I have been reading I can do it with std::list, although I've never used it before.
|
|
|
|
|
piul wrote: For what I have been reading I can do it with std::list...
True, as well as std::vector .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
This problem probably sounds silly but I can't get my head round it; there it goes:
#include <DelimFileParser.h>
int a;
typedef struct
{
std::string m_devTrainId;
std::string m_devIp;
...
The compiler's message:
Linking...
CDeviceFileParser.obj : error LNK2005: "int a" (?a@@3HA) already defined in CCommsManager.obj
CSnapLogger.obj : error LNK2005: "int a" (?a@@3HA) already defined in CCommsManager.obj
snaplogger_main.obj : error LNK2005: "int a" (?a@@3HA) already defined in CCommsManager.obj
snaplogger_main.h includes CSnapLogger.h
CSnapLogger.h includes CCommsManager.h
CCommsManager.h includes CDeviceFileParser.h
|
|
|
|
|
If you want to use this variable only in this source module then add the static keyword thus:
static int a;
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
|
If you want a global variable to be accessed from all files, make the definition in the source file (.c, .cpp etc.) instead of a header file.
In the header do a declaration like this - extern int a;
|
|
|
|
|
Hi All
I am developing the VC++(MFC) base application using visulstudio 2008.
Please suggest the best tool for find out the memory leakage from my application.
Thanks In Advance
|
|
|
|
|
Visual Studio has some support[^] to do this. I have also used Insure++[^].
Best wishes,
Navaneeth
|
|
|
|
|
|
|
|
Hi all,
please tell me how can get the name of connected windows mobile.
thanks in advance.
|
|
|
|
|
|
this code generate these errors
1>------ Build started: Project: DeviceInfo, Configuration: Debug Win32 ------
1>Linking...
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
1>Debug\DeviceInfo.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:\Program Files (x86)\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Samples\CPP\Win32\Deviceinfo\Debug\BuildLog.htm"
1>DeviceInfo - 3 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
please tell me how can i resolve it.
|
|
|
|
|
|