|
J_E_D_I wrote: '_T': identifier not found
#include <tchar.h>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks, I do not get that error anymore...but I get all those ones!
Error 1 error C2065: 'MAX_PATH' : undeclared identifier
Error 2 error C2065: 'DWORD' : undeclared identifier
Error 3 error C2146: syntax error : missing ';' before identifier 'volumeSerialNumber'
Error 4 error C2065: 'DWORD' : undeclared identifier
Error 5 error C2146: syntax error : missing ';' before identifier 'maxNameLength'
Error 6 error C2065: 'maxNameLength' : undeclared identifier
Error 7 error C2065: 'DWORD' : undeclared identifier
Error 8 error C2146: syntax error : missing ';' before identifier 'fileSystemFlags'
Error 9 error C2065: 'fileSystemFlags' : undeclared identifier
Error 10 error C2065: 'MAX_PATH' : undeclared identifier
Error 11 error C2065: 'maxNameLength' : undeclared identifier
Error 12 error C2065: 'fileSystemFlags' : undeclared identifier
Error 13 error C2065: 'systemName' : undeclared identifier
Error 14 error C2065: 'MAX_PATH' : undeclared identifier
Error 15 error C2078: too many initializers
|
|
|
|
|
What other header files are you including?
Those errors indicate windows.h is not included.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Actually, windows.h is already included in the .cpp file...
These are the other header files I've got:
#include "stdafx.h"
#include "Form1.h"
#include tchar.h
#include vector
#include ctime
#include math.h
#include fstream
#include string
#include iostream
#include sstream
using std::dec;
using std::hex;
#include iomanip
using std::setprecision;
using std::setbase;
#include cstdlib
using std::atof;
#include windows.h
#pragma comment(lib, "user32.lib")
#include stdio.h
#include cstdio
#include strsafe.h
using namespace Ex22_01;
(Note: I had to remove < and > from the directives as otherwise it would not show up in this message)
|
|
|
|
|
Hi,
it may come as a surprise, but the order of the includes matters too.
i.e. if tchar.h relies on windows.h, then windows.h must precede tchar.h;
normally if you suddenly need another include, you put it at the end of the list.
BTW: the behavior of message editing regarding < and > depends on the checked state of "Ignore HTML tags in this message" checkbox.
|
|
|
|
|
Luc, you are absolutely right! I've changed the order of the include directives and it works like a breeze.
Thank you so much for this, I admit I would have never thought about it.
|
|
|
|
|
You're welcome.
|
|
|
|
|
Hi again Luc, I was wondering if you had any hint on how to solve this problem which is somehow linked to the previous one. I need to save the value obtained with the previous code (which is a DWORD: DesiredValue) in a registry key and this was the syntax I was using (successfully) in console environment.
DWORD DesiredValue;
HKEY Xtmpkey;
DWORD dwDisp = 0;
LPDWORD xlpdwDisposition = &dwDisp;
DWORD dwVal = DesiredValue;
RegCreateKeyEx(HKEY_CURRENT_USER, L"SOFTWARE\\MyPath", 0L,NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &Xtmpkey,xlpdwDisposition);
RegSetValueEx (Xtmpkey, L"Desired_Value_Name", 0L, REG_DWORD,(CONST BYTE*) &dwVal, sizeof(DWORD));
Now that I am porting the software into C++/CLI environment it returns the following errors:
Error 1 error LNK2001: unresolved external symbol "extern "C" long __stdcall RegCreateKeyExW(struct HKEY__ *,wchar_t const *,unsigned long,wchar_t *,unsigned long,unsigned long,struct _SECURITY_ATTRIBUTES * const,struct HKEY__ * *,unsigned long *)" (?RegCreateKeyExW@@$$J236YGJPAUHKEY__@@PB_WKPA_WKKQAU_SECURITY_ATTRIBUTES@@PAPAU1@PAK@Z)
Error 2 error LNK2001: unresolved external symbol "extern "C" long __stdcall RegSetValueExW(struct HKEY__ *,wchar_t const *,unsigned long,unsigned long,unsigned char const *,unsigned long)" (?RegSetValueExW@@$$J224YGJPAUHKEY__@@PB_WKKPBEK@Z)
Error 3 fatal error LNK1120: 2 unresolved externals
What am I doing wrong?
I thank you in advance.
|
|
|
|
|
Hi,
there are two ways to solve this:
1.
most registry operations are supported in .NET by the Registry class
things not supported include special key types (not REG_SZ)
2.
when the Registry class does not offer what you need, you have to call the native functions (such as RegCreateKeyEx).
I don't know the details for C++, but you somehow must tell it where the library functions can be found,
and how they should be called.
This article[^] probably contains all you need and more.
FYI: in C# there is only one way to access native code, that is thru P/Invoke.
Remark: you would better have started a new thread for a question that hardly is connected to an old topic... that would have improved your chances for someone else to pick it up.
|
|
|
|
|
As Luc mentioned, the order of the #includes can be a factor.
Another recent post asked about tchar.h and I tested it - it can be
used all by itself and it pulls in any additional header files it needs,
so I wouldn't think that's an issue here..
In your stdafx.h file, you may be missing the Windows versioning macros.
The macros have changed a bit in recent SDK versions, but if you create a dummy
project (MFC or Win32) you can look at the stdafx.h file and see the defaults.
For example, here's a stdafx.h file from one of my projects, using the latest SDK
on VS 2008:
#pragma once
#define WIN32_LEAN_AND_MEAN
#include "<code>targetver.h</code>"
#include <stdio.h>
#include <tchar.h>
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN
#endif
#include <windows.h>
#pragma once
#ifndef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_WINXPSP2
#endif
#ifndef WINVER
#define WINVER _WIN32_WINNT_WINXP
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_WINXP
#endif
#ifndef _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0410
#endif
#ifndef _WIN32_IE
#define _WIN32_IE 0x0600
#endif
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark, thanks for this detailed suggestion. Luc's advice however solved the problem easily and for the time being I'll stick with it. I'll definitely look into your solution if a similar problem happens in the future. Cheers
|
|
|
|
|
Use #include "atlstr.h" or #include "afx.h" header file.
|
|
|
|
|
I am using an unmanaged library made by Valve in a wrapper.
When this line of code executes:
if ( fileSystem->Init() != INIT_OK ) throw gcnew Exception(fileSystemDllName + " IFileSystem::Init failed.");
No exception is thrown. Instead the function prints this message to the debug output:
SteamStartup() failed: SteamStartup(0xf,0x06C9EAA0) failed with error 1: failed to take master pipe connection lock
Immediately after, the main thread exits. I KNOW why this is happening and I know how to fix it. That is not my question. What I need to know is how I can get my wrapper DLL to trap debug output, and at least put up a message box repeating the error, such as the one above.
I made a new class - .h and .cpp combined for brevity:
ref class SteamDebugListener : public System::Diagnostics::TraceListener
{
public:
SteamDebugListener(void)
{
}
virtual void Write(String^ Message) override
{
if (message->Contains("Steam") && message->Contains("error"))
{
MessageBox::Show(message->Trim());
}
}
virtual void WriteLine(String^ Message) override
{
if (message->Contains("Steam") && message->Contains("error"))
{
MessageBox::Show(message->Trim());
}
}
};
And added this:
SteamDebugListener^ errorCatch = gcnew SteamDebugListener();
System::Diagnostics::Debug::Listeners->Add(errorCatch);
System::Diagnostics::Trace::Listeners->Add(errorCatch);
before the failing call, and set a breakpoint in the Write function, but it is not being called. What is the correct way to do all this?
|
|
|
|
|
hi all
i need to mae a client to server chat .. just like the ivoclize
https://www.ivocalize.com/[^]
this project .. well be baseb on web admin control panels ... and the the web admin will e able to creat , edit , delete rooms and users
the client contains text chat , voice chat , white board , web browser , and power point presentation
this is the room image
any one can help me to creat this ... ? and what it willcoast me ?
http://photos4.hi5.com/0068/804/671/w8Zjnx804671-02.jpg[^]
|
|
|
|
|
Member 3983764 wrote: any one can help me to creat this ... ? and what it willcoast me ?
I can help you for US $75 per hour.
|
|
|
|
|
Hello guys,
I've a big problem with VC++2008. Till now it was working fine, than I created a new project tried to compile it and I get the error message:
fatal error c1902: error in program database manager. check installation.
I didn't change anything within my IDE I just tried to compile a project.
I already tried to reinstall the IDE but this didn't help, I still get this error.
I'll try de-installing VC++2008 and deleting all components, maybe than a reinstallation will work.
At the same time I got this problem with my VC++2005. Same error but I tried to recompile an old project when it occured.
However, my VS2003.NET is still working fine. But I need VC++2008 for a special project.
Does anyone have an idea about this?
Thanks and best wishes,
Manfred
|
|
|
|
|
According to MS and several forums you have to place a file called mspdb80.dll in \WINDOWS\system32\ if this error occurs. I already added this file becuase I needed it in another project. However, there was another version of this file too called mspdb60.dll. I deleted the 80-version and my IDE workes again.
|
|
|
|
|
When I put ultraGrid on my form and I compile the program I have an error:
UltraGrid is not member of Infragistics::Win
And when I Write namespace Infragistics::Win::UltraWinGrid, I have the same error on this line.
What to do so to use Infragistics components in Visual C++ NET 2005
|
|
|
|
|
I'm using CWinFormControl to create instances of .Net UserControls.
CWinFormsControl<myproject::mycontrol xmlns:myproject="#unknown"> m_control;
m_control.CreateManagedControl( WS_CHILD | WS_VISIBLE, rect, this, IDC_HOSTCONTROL );
This works fine. The problem occurs when I try to destroy the control. I need a deterministic call to the 'MyControl' finalizer, so I wrote the following:
m_control.DestroyWindow();
System::GC::Collect();
This code does not cause the Finalize\Dispose code to be called on 'MyControl'. In fact, 'MyControl' sticks around in memory until the MFC app closes. What am I doing wrong here?
Thanks,
Aaron
|
|
|
|
|
astibich2 wrote: I need a deterministic call to the 'MyControl' finalizer
Then why are you using a Garbage Collection system? Ever heard of the word "Contradiction"?
led mike
|
|
|
|
|
Hi
yesterday I was trying to build a program but i had a problem ...!
the problem was that when I put space (" ") in the string, it finishes the string aoutomatically , so what canI do to fix the problem?
notice that i cant use a array of characters in that solution
|
|
|
|
|
sajjy wrote: the problem was that when I put space (" ") in the string, it finishes the string aoutomatically
How? Some sample code would help!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: How?
Probably using the space in his head.
led mike
|
|
|
|
|
Space....the final frontier....
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Space....the final frontier
We kunt do it kaptin, we just dunt have the power!
led mike
|
|
|
|