|
Hi,
When I try to build the workspace of my MFC DLL application it shows a link error as follows.
"LINK : error : Internal error during EmitMap
ExceptionCode = C0000005
ExceptionFlags = 00000000
ExceptionAddress = 0043FA39
NumberParameters = 00000002
ExceptionInformation[ 0] = 00000000
ExceptionInformation[ 1] = 000000F1
CONTEXT:
Eax = 007C80ED Esp = 0012F7C0
Ebx = 000000ED Ebp = 0012F8DC
Ecx = 0056D670 Esi = 007C80ED
Edx = 000000ED Edi = 007C80ED
Eip = 0043FA39 EFlags = 00010206
SegCs = 0000001B SegDs = 00000023
SegSs = 00000023 SegEs = 00000023
SegFs = 0000003B SegGs = 00000000
Dr0 = 0012F7C0 Dr3 = 000000ED
Dr1 = 0012F8DC Dr6 = 0056D670
Dr2 = 00000000 Dr7 = 00000000
Error executing link.exe.
Tool execution canceled by user."
When I build once again, it will be OK.
Anyone know what is happening?
Thanx in advance.
|
|
|
|
|
Actually no! I have a guess though – incremental compilation will sometimes result in a similar error because it did not know to recompile a particular piece of code, for some reason. Normally you can fix it by recompiling all, which may take a while. The thing that bothers me is the exception code; that is a code you never want to see and is what you normally see on a blue screen.
In either case I does not really matter unless you are the one creating the compiler, just recompile all.
I understand the reason you want to know, but you will run across many questions like that. If you dwell on them, they will drive you nuts, so just learn to accept them. If you are like me that may not be acceptable, but given time you will learn.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Hello i have a function OnStart(){}
and inside this function there is a CArray<cstring ,="" cstring=""> FArray
that contains Filepathnames.
i want to create a function that take as a parametr CArray (so i can execute it inside OnStart() )
I try to create but when i put FindDF(CArray<cstring ,="" cstring=""> nArray) it says me i cant put < >
|
|
|
|
|
You need to have something like this:
FindDF(const CArray& filepathnames)
Kevin
|
|
|
|
|
i put
Find ( CString file , const CArray& FArray)
c:\program files\microsoft visual studio\myprojects\anaktisi\anaktisidlg.h(18) : error C2143: syntax error : missing ',' before '&'
c:\program files\microsoft visual studio\myprojects\anaktisi\anaktisidlg.h(18) : error C2059: syntax error : '&'
C:\Program Files\Microsoft Visual Studio\MyProjects\Anaktisi\AnaktisiDlg.cpp(850) : error C2955: 'CArray' : use of class template requires template argument list
c:\program files\microsoft visual studio\vc98\mfc\include\afxtempl.h(238) : see declaration of 'CArray'
C:\Program Files\Microsoft Visual Studio\MyProjects\Anaktisi\AnaktisiDlg.cpp(851) : error C2511: 'Find' : overloaded member function 'double (class CString,const class CArray &)' not found in 'CAnaktisiDlg'
c:\program files\microsoft visual studio\myprojects\anaktisi\anaktisidlg.h(14) : see declaration of 'CAnaktisiDlg'
|
|
|
|
|
Immunity18 wrote: c:\program files\microsoft visual studio\myprojects\anaktisi\anaktisidlg.h(18) : error C2143: syntax error : missing ',' before '&'
Did you forget #include <afxtempl.h> in your project's stdafx.h file?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
#include "stdafx.h"
its the first of my include
|
|
|
|
|
Immunity18 wrote: #include "stdafx.h"
its the first of my include
Meaning what?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i because it was <afx> it wasn't visible and i thought u said
did you forget to #include , in your project, the "stdafx.h" file ?
And yes i didnt #include "afxtempl.h"
but not that i forget ,because i didnt know i had :P
|
|
|
|
|
Now i include it my
double CAnaktisiDlg::FindDF(CString file , CArray < CString, CString > FArray)
works fine
thank you onces again David
(both kevin and mark )
|
|
|
|
|
Here's an example of how to pass an array argument from the CArray implementation in afxtempl.h
INT_PTR CArray<TYPE, ARG_TYPE>::Append(const CArray& src)
{
ASSERT_VALID(this);
ASSERT(this != &src);
if(this == &src)
AfxThrowInvalidArgException();
INT_PTR nOldSize = m_nSize;
SetSize(m_nSize + src.m_nSize);
CopyElements<TYPE>(m_pData + nOldSize, src.m_pData, src.m_nSize);
return nOldSize;
}
Kevin
|
|
|
|
|
Since CArray is a template class, you need to declare your array type as such.
You can either use something like this
CArray<CArrayMembersClass, CArrayMembersClass&>
or to shorten things up, use typedef to create an alias for the template class:
typedef CArray<CArrayMembersClass, CArrayMembersClass&> CArrayMembersClassArray;
and use "CArrayMembersClassArray" as a variable type.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
i tried
FindDF(CString file , CArray < CString, CString& > FArray)
and when i press OK nothing happends (pressed it many times)
|
|
|
|
|
I'm sorry...what?
What do you mean you "press ok"? Runtime? Design time?
I'm lost
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hehehe sorry i let you alone inside forest
Ok here i am to rescue u !
i use Microsoft Visual studio C++ 6.0 enviroment
i press right click on the Class and press Add member function
on the window it pop up i time
Type: double
Function declaration : Find(CString file , ....) and i have to press OK or cancel
|
|
|
|
|
Ohhh ok
I've never used the add function wizard but I just tried it on VS 2003 .NET.
I chose "Add/Add function.." for a class.
Selected a return type
typed a function name
for the parameter type, I typed "CArray<int, int&> &"
parameter name I typed MyIntArray
clicked the Add button to add the parameter
clicked Finish and the function was added to my class
I'm not sure how different that is from VC 6 (I bet David Crow knows )
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
double CAnaktisiDlg::FindDF(CString file , CArray < CString, CString& > &FArray)
is what i create (indetifier CArray error)
double CAnaktisiDlg::FindDF(CString file , CArray < CString, CString& > FArray)
same :/
according to you it had to be working fine
|
|
|
|
|
Works for me but I'm on a different VS version.
I also have included afxtempl.h in my projects, although I'm not sure if the wizard uses that...
You can always add the function by hand
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi, I cann't take my own IP address on Windows Server 2003.
This is the code i'm using, it works fine in Windows 2000 (Professional and Server) and Windows XP, but DOESN'T WORK IN Windows Server 2003.
I'm getting crazy, Why it doesn't work only in Windows 2003?
int iSockErr = 0;
HANDLE hnd = 0;
WORD wVersionRequested = MAKEWORD(2, 2);
WSADATA wsaData;
try
{
if ((iSockErr = WSAStartup(wVersionRequested, &wsaData)) != 0) { throw 1; }
DWORD dw;
GUID guid = SVCID_HOSTNAME;
struct AUX{
WSAQUERYSET qsRestrictions;
BYTE byte[500];
}aux;
memset(&aux.qsRestrictions, 0, sizeof(WSAQUERYSET));
aux.qsRestrictions.dwSize = sizeof(WSAQUERYSET);
aux.qsRestrictions.lpServiceClassId = &guid;
if (WSALookupServiceBegin(&aux.qsRestrictions, LUP_RETURN_ADDR, &hnd)) { throw 2; }
dw = sizeof(aux);
memset(&aux, 0, sizeof(aux));
aux.qsRestrictions.dwSize = sizeof(WSAQUERYSET);
while ( !WSALookupServiceNext(hnd, LUP_RETURN_ADDR, &dw, &aux.qsRestrictions) )
{
ptyIP->d0 = aux.qsRestrictions.lpcsaBuffer[0].RemoteAddr.lpSockaddr->sa_data[2];
ptyIP->d1 = aux.qsRestrictions.lpcsaBuffer[0].RemoteAddr.lpSockaddr->sa_data[3];
ptyIP->d2 = aux.qsRestrictions.lpcsaBuffer[0].RemoteAddr.lpSockaddr->sa_data[4];
ptyIP->d3 = aux.qsRestrictions.lpcsaBuffer[0].RemoteAddr.lpSockaddr->sa_data[5];
}
...
Thank you very much.
|
|
|
|
|
alejandrofuchs wrote: Why it doesn't work only in Windows 2003?
Why don't you tell us? What does WSAGetLastError() return?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks,
It returns 0, indicating there is no error, but no data is returned.
alejandrofuchs@yahoo.com
|
|
|
|
|
Thanks!
First, i'm sorry, someone else (joseaxy) was already signed in codeproject in this machine, so my later response had that name.
Second (again i'm sorry), i responded wrong, the rigth answer is: WSAGetLastError() returns 10110, WSALookupServiceNext is returning 0 the second time it is called.
alejandrofuchs@yahoo.com
|
|
|
|
|
alejandrofuchs wrote: WSAGetLastError() returns 10110...
Which resolves to WSA_E_NO_MORE .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
alejandrofuchs wrote: First, i'm sorry, someone else (joseaxy) was already signed in codeproject in this machine, so my later response had that name.
hmmm...split personality?
If you try getaddrinfo(), does that work on Server 2003?
Something like:
char szHostName[256];
if (0 == ::gethostname(szHostName, sizeof(szHostName)))
{
char* port = "80";
addrinfo aiHints;
addrinfo *aiList = NULL;
int retVal;
memset(&aiHints, 0, sizeof(aiHints));
aiHints.ai_family = AF_INET;
aiHints.ai_socktype = SOCK_STREAM;
aiHints.ai_protocol = IPPROTO_TCP;
if ((retVal = ::getaddrinfo(szHostName, port, &aiHints, &aiList)) == 0)
{
addrinfo *pAddrInfo = aiList;
while (pAddrInfo)
{
pAddrInfo = pAddrInfo->ai_next;
}
<code>::freeaddrinfo(aiList);
}
}
-- modified at 14:41 Friday 8th June, 2007
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Yes, this works. I will change my code.
I still have the doubt about why it doesn't work only on Windows 2003, but as this code works fine i prefer this new aproach.
Thank you to you all for your help!
PD. Only for curiosity , if somebody find out what's wrong on the original code under 2003, please write.
alejandrofuchs@yahoo.com
|
|
|
|