|
includeh10 wrote:
GetTest(3);//error line
Change to:
AA::GetTest(3);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Try the following:
AA::GetTest(3);
It's time for a new signature.
|
|
|
|
|
|
includeh10 wrote: not what I need
Well, thank you for such a detailed description of your problem!
Exactly how do you expect people to help you solve your problems without explaining what those problems are in detail. We cannot read your mind or guess at the results of your compilations or tests from thousands of miles distance.
It's time for a new signature.
|
|
|
|
|
includeh10 wrote: not what I need
Then what do you need? The previous answer is correct, and does answer your question. A virtual function is overridden, and the only way to access a base class implementation is to explicitly specify the base class as the other user has indicated.
|
|
|
|
|
in class BB add: using A::GetTest;
|
|
|
|
|
I'm trying to run some sample code from the Microsoft site that demonstrates Unicode normalization:
http://msdn.microsoft.com/en-us/library/dd319092(v=VS.85).aspx[^]
It compiles, but I get two link errors:
Linking...
UnicodeTest.obj : error LNK2019: unresolved external symbol __imp__NormalizeString@20 referenced in function "void __cdecl TryNormalization(enum _NORM_FORM,wchar_t *)" (?TryNormalization@@YAXW4_NORM_FORM@@PA_W@Z)
UnicodeTest.obj : error LNK2019: unresolved external symbol __imp__IsNormalizedString@12 referenced in function "void __cdecl TryNormalization(enum _NORM_FORM,wchar_t *)" (?TryNormalization@@YAXW4_NORM_FORM@@PA_W@Z)
Debug\UnicodeTest.exe : fatal error LNK1120: 2 unresolved externals
The DLL with these functions is on my system here:
C:\Windows\System32\normaliz.dll
So why am I getting the link errors? If I try to define the stuff it says is not defined, I then get an error that it's already defined.
|
|
|
|
|
I never used NLS, but expect NLS to have some lib, mostly Normaliz.lib.
U have linking error, so try after including Normaliz.lib for linking.
Величие не Бога может быть недооценена.
|
|
|
|
|
i'm stuck with this problem
well i made this header "shapes.h"
#ifndef SHAPES_H
#define SHAPES_H
#define maxC 80
#define maxV 25
#define maxP 150
struct circles
{
int count;
float radius[maxC];
b2Vec2 center[maxC];
};
struct polygon
{
int count;
int vertex_count[maxV];
b2Vec2 vertex[maxP][maxV];
};
circles cl;
polygon pg;
#endif
sry for lame data structure but had to take like that
i've included it in my main.cpp
and thr's another header "simulate.h"
that needs to be included in "main.cpp"
now the problem is i have to include "shapes.h" in "simulate.h" too.. but when i do that i get error
1>simulate.obj : error LNK2005: "struct polygon pg" (?pg@@3Upolygon@@A) already defined in main.obj
1>simulate.obj : error LNK2005: "struct circles cl" (?cl@@3Ucircles@@A) already defined in main.obj
1>editor/Debug\editor.exe : fatal error LNK1169: one or more multiply defined symbols found
i tried removing "shapes.h" from "main.cpp" with "simulate.h" included in "main.cpp" and "shapes.h" included in "simulate.h" but still get the same error.
please help... i'm using Visual Studio 2008
modified on Friday, April 2, 2010 3:57 PM
|
|
|
|
|
There are two ways to deal with this. One is to put the word "extern" in front of the declarations in the header file and then in one and ONLY one place (main.cpp most likely) add those declarations again without the "extern" in front of them.
The second option is to do this -
In the header file :
#ifdef DECLARE_GLOBALS
#define GLOBAL
#else
#define GLOBAL extern
#endif
GLOBAL circles cl;
GLOBAL polygon pg;
Then in just ONE of the .cpp files, again like main.cpp, do this :
#define DECLARE_GLOBALS
#include "shapes.h"
This scheme can work with virtually any global variables if you really need to use them.
|
|
|
|
|
may be i did someting wrong but with what u have told i'm getting the error
1>main.obj : error LNK2001: unresolved external symbol "struct polygon pg" (?pg@@3Upolygon@@A)
1>main.obj : error LNK2001: unresolved external symbol "struct circles cl" (?cl@@3Ucircles@@A)
1>editor/Debug\editor.exe : fatal error LNK1120: 2 unresolved externals
please tell me how should i include my headers now... both in main.cpp and simulate.h ir is thr any other way
|
|
|
|
|
If you have an unresolved external error from the linker then you did not do what I said to exactly. Copy and paste the two definitions I showed in the previous post and put them where I said they need to go and it should work fine. I have used this technique for a long time with several different compilers and not had any problems.
|
|
|
|
|
In addition to what Rick has been telling you, maybe you should spend some time studying the difference between definition and declaration? Possibly something about storage classifiers and scope?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
It is not a good idea to create global variables inside a header file.
So create a shapes.cpp file and put the global variables inside them.
In the shapes.h header file put the extern keyword before the global variable creation statement as mentioned in the other posts.
|
|
|
|
|
Hi,
I have read Jeffery Richter book On Duplicating Object Handles and am still confused how to get a real process handle
so...
If I am in a Childprocess trying to duplicate its handle for the Parent
I tried the following code in the Child Process
p.s. can some one point to where the documentation is for for using code tags for code snipets
I was sure it was on the menu bar from the Home page .....
<br />
<br />
snap_shot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);<br />
<br />
process32.dwSize = sizeof(PROCESSENTRY32);<br />
<br />
return_cde = Process32First(snap_shot,&process32);<br />
<br />
pid = GetCurrentProcessId();
<br />
while(pid != process32.th32ProcessID)<br />
{<br />
return_cde = Process32Next(snap_shot,&process32);<br />
}<br />
<br />
parent_process = process32.th32ParentProcessID;<br />
<br />
then DuplicateHandle(GetCurrentProcesId(),GetCurrentProcessId(),parent_process,&child_process_handle_in_context_of_parent,0,FALSE,DUPLICATE_SAME_ACCESS);
no Luck
In Parent process
<br />
<br />
return_code = CreateProcess(NULL,<br />
(LPCSTR) &child_buff[0],<br />
NULL,<br />
NULL,<br />
TRUE,<br />
NULL,<br />
NULL,<br />
NULL,<br />
&si,<br />
&pi);<br />
<br />
global_area_handle = pi.hProcess<br />
<br />
the DuplicateHandle(GetCurrentProcessId(),GetCurrentProcessId(),global_area_handle,&parent_in_context_of_child_handle,0,FALSE,DUPLICATE_SAME_ACCESS);<br />
<br />
no luck<br />
<br />
thankx
|
|
|
|
|
ForNow wrote: can some one point to where the documentation is for for using code tags for code snipets
Did you see the code block button at the top of the edit screen?
It's time for a new signature.
|
|
|
|
|
Is this a "feature" of VC 6.0 only?
The associated list box puts the scroll bar on the right and aligns the text on right also.
Now the user have to select the list box from left and select from the list box on right.
It is not a major problem, but...
Only constructive comments to the subject will be appreciated.
No lectures please.
Thanks for reading.
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: Only constructive comments to the subject will be appreciated.
No lectures please.
What does the documentation say?
It's time for a new signature.
|
|
|
|
|
Right aligned text
Specifies that text is right-aligned within the dialog box. Type: Bool. Default: False.
|
|
|
|
|
Hi Forum
I have problem to write string in text file.I have a file which is create through admin account now i want to write string from lmited user account.I ahve use CStdioFile for create a file.Here is code
if( myFile.Open("C:\\Documents and Settings\\All Users\\Documents\\Adminfile.txt", CStdioFile::modeCreate | CStdioFile::modeWrite | CStdioFile::modeNoTruncate, &e ) )
{
myFile.SeekToEnd();
myFile.WriteString("AdminSting");
myFile.Close();
}
How can i write data in this file?
please help me.
|
|
|
|
|
Boost2010 wrote: I have problem...
...that you've not described. Without knowing what the code snippet is doing, how can we know what to suggest?
"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
|
|
|
|
|
thanks for reply
i am showing code there how i create file and write data.In Fact i am trying to make log file when user plug usb device in system that time i write data in file.I use
odevicechange() for usb device.
Plese help me
|
|
|
|
|
Boost2010 wrote: Plese help me
With what? You've posted twice now and still haven't described the problem.
"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
|
|
|
|
|
Here is code
void CTestDlg::UpdateDevice(PDEV_BROADCAST_DEVICEINTERFACE pDevInf, WPARAM wParam)
{
ASSERT(lstrlen(pDevInf->dbcc_name) > 4);
CString szDevId = pDevInf->dbcc_name+4;
int idx = szDevId.ReverseFind(_T('#'));
ASSERT( -1 != idx );
szDevId.Truncate(idx);
szDevId.Replace(_T('#'), _T('\\'));
szDevId.MakeUpper();
CString szClass;
idx = szDevId.Find(_T('\\'));
ASSERT(-1 != idx );
szClass = szDevId.Left(idx);
CString szLog;
CString szTmp;
if ( DBT_DEVICEARRIVAL == wParam )
{
pendrive++;
if(pendrive==1)
{
}
else
{
szTmp.Format(_T("Adding %s\r\n"), szDevId.GetBuffer());
pendrive=0;
szTmp.Trim();
int nPos=szTmp.Find("_");
CString cyt1=szTmp.Left(szTmp.GetLength()-nPos);
CString cyt2=cyt1.Right(cyt1.GetLength()-nPos-1);
CString fi=cyt2;
int rep=fi.Replace("&PROD_"," ");
int nPon1=fi.Find("&");
final=fi.Left(nPon1);
}
} else
{
pendrive++;
if(pendrive==1)
{
}
else
{
szTmp.Format(_T("Removing %s\r\n"), szDevId.GetBuffer());
szDevId.ReleaseBuffer();
szTmp.Trim();
int nPos=szTmp.Find("_");
CString cyt1=szTmp.Left(szTmp.GetLength()-nPos);
CString cyt2=cyt1.Right(cyt1.GetLength()-nPos-1);
CString fi=cyt2;
int rep=fi.Replace("&PROD_"," ");
int nPon1=fi.Find("&");
CString finalep=fi.Left(nPon1);
char dateStr [9];
char timeStr [9];
_strdate( dateStr);
_strtime( timeStr );
CString date=dateStr;
CString time=timeStr;
CString datatime=date;
datatime+=" ";
datatime+=time;
CStdioFile myFile,myFilereport;
CFileException e;
if( myFile.Open( ""C:\\Documents and Settings\\All Users\\Documents\\Adminfile.txt"", CStdioFile::modeCreate | CStdioFile::modeWrite | CStdioFile::modeNoTruncate, &e ) )
{
myFile.SeekToEnd();
myFile.WriteString("======================================================================================================\n");
myFile.WriteString(" Disconnect infmation");
myFile.WriteString("\n");
myFile.WriteString("======================================================================================================\n");
myFile.WriteString("USB Devidce ID:");
myFile.WriteString(finalep);
myFile.WriteString("\n");
myFile.WriteString("USB Devidce Connection Time:");
myFile.WriteString(datatime);
myFile.WriteString("\n");
myFile.WriteString("======================================================================================================\n");
myFile.WriteString("\n");
}
}
}
szLog.Append(szTmp);
szLog.Trim();
if ( _T("ROOT") == szClass ) {
return;
}
DWORD dwFlag = DBT_DEVICEARRIVAL != wParam ?
DIGCF_ALLCLASSES : (DIGCF_ALLCLASSES | DIGCF_PRESENT);
HDEVINFO hDevInfo = SetupDiGetClassDevs(NULL,szClass,NULL,dwFlag);
if( INVALID_HANDLE_VALUE == hDevInfo ) {
return;
}
SP_DEVINFO_DATA spDevInfoData;
if ( FindDevice(hDevInfo, szDevId, spDevInfoData) ) {
DWORD DataT ;
TCHAR buf[MAX_PATH];
DWORD nSize = 0;
if ( SetupDiGetDeviceRegistryProperty(hDevInfo, &spDevInfoData,
SPDRP_FRIENDLYNAME, &DataT, (PBYTE)buf, sizeof(buf), &nSize) ) {
} else if ( SetupDiGetDeviceRegistryProperty(hDevInfo, &spDevInfoData,
SPDRP_DEVICEDESC, &DataT, (PBYTE)buf, sizeof(buf), &nSize) ) {
} else {
lstrcpy(buf, _T("Unknown"));
}
HTREEITEM hClass = GetClassItem(&(spDevInfoData.ClassGuid), wParam);
if ( NULL == hClass ) return;
HTREEITEM hChildItem = m_ctrlTree.GetChildItem(hClass);
BOOL bFound = FALSE;
while (hChildItem != NULL) {
CString* pszData = (CString*)m_ctrlTree.GetItemData(hChildItem);
if ( szDevId == *pszData ) {
bFound = TRUE;
if ( DBT_DEVICEARRIVAL == wParam ) {
break;
} else {
delete pszData;
m_ctrlTree.DeleteItem(hChildItem);
if ( !m_ctrlTree.ItemHasChildren(hClass) ) {
HeapFree(GetProcessHeap(), 0, (LPVOID)m_ctrlTree.GetItemData(hClass));
m_ctrlTree.DeleteItem(hClass);
}
break;
}
} else {
hChildItem = m_ctrlTree.GetNextItem(hChildItem, TVGN_NEXT);
}
}
if ( DBT_DEVICEARRIVAL == wParam && !bFound ) {
int n = GetClassImgIndex(&(spDevInfoData.ClassGuid));
HTREEITEM hItem = m_ctrlTree.InsertItem(buf, n, n, hClass);
m_ctrlTree.SetItemData(hItem, (DWORD_PTR)(new CString(szDevId)));
m_ctrlTree.Expand(hClass, TVE_EXPAND);
}
}
|
|
|
|
|
You've posted thrice now and still haven't described the problem.
"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
|
|
|
|