|
This thing reads like satellite instructions. From what I can tell I think the problem lies in the mfcs42.lib, but I really don't know what they mean by fixing this. This is a MFC module. Not mine. Unless the fix is within my module.
Linking...
Searching Libraries
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\mfcs42d.lib:
mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in CreateCharacterCls.obj
mfcs42d.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already defined in CreateCharacterCls.obj
Searching \Program Files\Microsoft Visual Studio\MyProjects\RoleMaker\CharacterCls\Debug\CharacterCls.lib:
Searching \Program Files\Microsoft Visual Studio\MyProjects\RoleMaker\DatabaseRoutinesCls\Debug\DatabaseRoutinesCls.lib:
Searching \Program Files\Microsoft Visual Studio\MyProjects\RoleMaker\CustomCtrlsCls\Debug\CustomCtrlsCls.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\mfc42d.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\msvcrtd.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\kernel32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\user32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\gdi32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\comdlg32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\winspool.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\advapi32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\shell32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\comctl32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\uuid.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\mfco42d.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\oledlg.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\ole32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\olepro32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\oleaut32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\urlmon.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\mfcd42d.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\odbc32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\odbccp32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\daouuid.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\mfcn42d.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\wsock32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\OLDNAMES.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\mfcs42d.lib:
Searching \Program Files\Microsoft Visual Studio\MyProjects\RoleMaker\CharacterCls\Debug\CharacterCls.lib:
Searching \Program Files\Microsoft Visual Studio\MyProjects\RoleMaker\DatabaseRoutinesCls\Debug\DatabaseRoutinesCls.lib:
Searching \Program Files\Microsoft Visual Studio\MyProjects\RoleMaker\CustomCtrlsCls\Debug\CustomCtrlsCls.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\mfc42d.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\msvcrtd.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\kernel32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\user32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\gdi32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\comdlg32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\winspool.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\advapi32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\shell32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\comctl32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\uuid.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\mfco42d.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\oledlg.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\ole32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\olepro32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\oleaut32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\urlmon.lib:
Done Searching Libraries
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in CreateCharacterCls.obj; second definition ignored
mfcs42d.lib(dllmodul.obj) : warning LNK4006: __pRawDllMain already defined in CreateCharacterCls.obj; second definition ignored
Creating library Debug/CreateCharacterCls.lib and object Debug/CreateCharacterCls.exp
Searching Libraries
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\mfcs42d.lib:
Searching \Program Files\Microsoft Visual Studio\MyProjects\RoleMaker\CharacterCls\Debug\CharacterCls.lib:
Searching \Program Files\Microsoft Visual Studio\MyProjects\RoleMaker\DatabaseRoutinesCls\Debug\DatabaseRoutinesCls.lib:
Searching \Program Files\Microsoft Visual Studio\MyProjects\RoleMaker\CustomCtrlsCls\Debug\CustomCtrlsCls.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\mfc42d.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\msvcrtd.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\kernel32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\user32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\gdi32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\comdlg32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\winspool.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\advapi32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\shell32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\comctl32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\uuid.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\mfco42d.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\oledlg.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\ole32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\olepro32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\oleaut32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\urlmon.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\mfcd42d.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\odbc32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\odbccp32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\daouuid.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\mfcn42d.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\wsock32.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\OLDNAMES.lib:
Done Searching Libraries
C:/Windows/System/CreateCharacterCls.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
CreateCharacterCls.dll - 3 error(s), 22 warning(s)
|
|
|
|
|
The above response is from me. It says anonymous. I sent this without signing on. Just clearing any confusion.
"Why are we hiding from the police, Daddy?"
"We use VI, son. They use Emacs."
|
|
|
|
|
Are you building an MFC extension DLL? Is it using AFX_MANAGE_STATE(AfxGetStaticModuleState( ) )? There's an article [Q161589] that describes this as an error in the docs that can lead to this link problem.
The output you posted was not what I expected - I thought the error would happen later and point to an obj file that wasn't bringing in the afx stuff.
BTW sometimes you can /force linkage in this type of scenario (Force file output on the Link / customize tab) but do this only for an experiment.
|
|
|
|
|
The tech docs referenced here fixed the problem.
FYI. using FORCE will help with the problem but will reak havoc during run time. I can't remember the specifics, but it causes problems with dialog based DLLs.
Thanks for the insight!
Chris
"Why are we hiding from the police, Daddy?"
"We use VI, son. They use Emacs."
|
|
|
|
|
|
|
Thank you, please continue !
|
|
|
|
|
|
CFile::Read( void* lpBuf, UINT nCount );
CFile::Read returns the number of bytes transferred to the buffer. If the value returned is less than nCount the end of file was reached.
Cheers!!!
Carlos Antollini.
|
|
|
|
|
I can display that 0-10 numbers....but then get a memory error message.....what's wrong?
int *pPtr;
pPtr = new int;
CString a;
for (int i=0; i<=10; i++)
{
*(pPtr+i) = i;
Display Pointer here.......
}
delete pPtr;
|
|
|
|
|
If you have only 10 items in the array, use ; i < 10 ; in the loop (0 to 9 are valid indices). A common gotcha, to be sure.
|
|
|
|
|
Actually, I'm looking for a infinite size of "array", so I want to see if i can use pointer to do that.......sometimes i need 10....but sometimes i need 40......that's why i create pointer.....
Do you know how?
|
|
|
|
|
Ah - ok - didn't look at your code carefully enough.
What you are doing is going to act differently in debug, release, and where the pointer is declared (in a function (on the stack) or global (on the heap). You will be able to store to the pointer as long as the increment doesn't take it outside of a valid memory location (which would be an access violation). But you will probably end up overwriting some other important data, which can corrupt the heap or the stack.
What you are looking for is, I think, a dynamic array - one which you can assign values to and have the array allocate more memory 'on the fly' to accomodate if necessary.
The STL's vector would be useful in this case - very handy. If you'd like to roll your own, you might want to look at MSPutils.h (in the platform SDK), which implements a simple placement new based container for Plain Old Data (POD) types - A related class is CSimpleArray, which extends this to classes with constructors and destructors.
But I think you should look at CArray (MFC) or vector (STL).
|
|
|
|
|
You've allocated space for one integer with 'new int'. You're trying to write 11 integers using *(pPtr + i). If you want this to work OK, you should use 'new int[11]'
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Unless I'm mistaken here, the line of code causing the memory error is
*(pPtr+i) = i;
You are trying to cause the pointer to point to memory that you have not allocated. Too boot, you then attempt to change the contents of that location by doing the assignment operation.
Chris
|
|
|
|
|
But I don't want to fix the number of elements......I want to create an infinite "array"......I can insert elements in this list unlimited........
Do you know how to do that?????
THANK YOU
|
|
|
|
|
> I want to create an infinite "array"
You'll need a computer with infinite memory. Not all users of your application will be able to buy one.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
The best that I think you can do is use some program variable that is set. It is difficult to contemplate what an infinite size array might be
int* pNumber = new int [SomeProgramVariable];
for (inti=0;i
|
|
|
|
|
Ouch .. I got bit by those $%#@&*(%$ tags again.
|
|
|
|
|
Use a MFC CArray or a STL vector.
|
|
|
|
|
The prolbem is that you are allocating enough memory to hold one int item only!!
so your code is accessing invalid memory!
the statement :
*(pPtr+i) = i; //this is going beyond the memory pointed to by pPtr!!
To create a dynamic array, you need to know the number of elements in it and then allocate it:
void MakeArray(int nCount)
{
int * pPtr = new int[nCount];
if (pPtr)
{
for (int i=0; i < nCount; ++i)
{
*(pPtr+i) = i; //This is ok
pPtr[i] = i; //is same as above!
.....
}
//Free the memory
delete [] pPtr;
}
}
Mh2!
|
|
|
|
|
You guys are great!!!!!!!
|
|
|
|
|
The correct code is as follows.
int *pPtr;
pPtr = new int[10]; //U were allocating for only a single integer
for (int i=0; i<10; i++)//u were doing 11 iterations 0 to 10
{
*(pPtr+i) = i;
}
delete[] pPtr; //u were deleting only a single element
void (*p[10]) (void (*)());
|
|
|
|
|
I am trying to use a grid control supplied on this web site. however, when i include the custom control on my form (im using an sdi app) i get the above error message, am I doing something wrong!?
thanks
|
|
|
|
|
I was in good old Chapters the other day I picked up one of the Stroustrup series books and read up a little on the topic, but I did not have time to finish. Does any one know of a good web site that explains the concepts behind implementing the visitor concept?
Thanks,
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|