|
With the information you have given is almost impossible to help you.
you should give more details, debugging your application and seeing what happens when it hangs, putting a bit of code...
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
HI all
please tell me is this possible to hide vertical scrollbar from printpreview window in mfc.
please provide me help and guidance regarding this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Hi All,
Please Help me with this issue.
How to access the balloon tooltip that comes when a device is connected to the system? I need to change the caption of that dialog.
Iam using VS 2005
Regards,
Spk
modified on Wednesday, December 30, 2009 10:47 PM
|
|
|
|
|
int main()
{
printf("Enter 0 or 1 :");
scanf("%d",&i_choice);
if ( i_choice ==0 )
for( ;i_count_1 < i_number;)
{-------
------
}
if (choice == 1)
for( ;i <= i_number;)
{-------
------
}
Here I raed a user input ( 0 or 1)
So as per i/p I've to change the condition in my for loop.
if choice ==1 the condition must be (i <= i_number)
if choice == 0 the condition must be (i_count_1 < i_number)
I don't know how to use #define with this program.
anybody can help me....
Krish
|
|
|
|
|
You don't need #define in your code sample, but you need a switch(i_choice) .
Maxwell Chen
|
|
|
|
|
here I wanna reduce the code size....
swith(i_choice) {
case 0 :
for (.. ; condition 1 ; ..)
{
}
break;
case 1 :
for (.. ; condition 2 ; ..)
{
}
break;
}
So the code will come twise ; except the conditions in for loop all other statements are same for case 1 and 0. That's why I tried for a #define Macro. ????
with regards
Krish
|
|
|
|
|
krish_kumar wrote: case 0 :
for (.. ; condition 1 ; ..)
Then could you show the complete code (I mean those ... portions)? I will figure out a solution for you.
Maxwell Chen
|
|
|
|
|
krish_kumar wrote: That's why I tried for a #define Macro. ????
Which would be totally wrong. The #define directive is handled by the preprocessor before the compile phase. You don't know the value of i_choice until the code is running. See 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
|
|
|
|
|
Okkk... I realize I can't use a #define here....
But my code is repeating twice ...I wanna avoid that....
Except condition the other statements are same for both...
Here is my code
printf("\n U wanna find prime nos up to N(press 1)
or N prime nos (press 0 ");
scanf("%d",&i_choice);
switch(i_choice) {
case 0 :
for (i = 1, i_count = 0; i_count_1 < i_number; i++ ) {
for (j = 1,i_count = 0; j <= i ; j++) {
if ((i % j) == 0)
++i_count;
}
if (i_count <= 2) {
printf("\t %d \n",i);
i_count_1++;
}
}
break;
case 1 :
for (i = 1, i_count = 0 ; i <= i_number; i++ ) {
for (j = 1, i_count = 0; j <= i ; j++) {
if( (i % j)==0 )
++i_count;
}
if (i_count <= 2) {
printf("\t %d \n",i);
i_count_1++;
}
}
}
}
|
|
|
|
|
 I would suggest you to re-design your code architecture. See the sample code below.
#include <iostream>
int GetNextPrime(int iStartNum)
{
int i, j;
int i_count;
for(i = iStartNum; ; i++) {
for(j = 1, i_count = 0; j <= i ; j++) {
if( (i % j) == 0 )
++i_count;
}
if(i_count <= 2) {
return i;
}
}
return 0;
}
void main()
{
int i_choice;
int i_count;
int i_count_1 = 0;
int i_number = 10;
int i, j;
int iValNow;
int count;
printf("Find prime nos up to %d (press 1), or %d prime nos (press 0) ", i_number, i_number);
scanf("%d", &i_choice);
printf("\n My version: \n");
switch(i_choice)
{
case 0 :
for(i = 0, iValNow = i, count = 0; count < i_number; i++, count++) {
iValNow = GetNextPrime(iValNow +1);
printf("\t %d \n", iValNow);
}
break;
case 1 :
for(iValNow = 0; ; ) {
iValNow = GetNextPrime(iValNow +1);
if(iValNow > i_number) {
break;
}
printf("\t %d \n", iValNow);
}
break;
}
printf("\n Your version: \n");
switch(i_choice)
{
case 0 :
for(i = 1, i_count = 0; i_count_1 < i_number; i++ ) {
for(j = 1,i_count = 0; j <= i ; j++) {
if( (i % j) == 0 )
++i_count;
}
if(i_count <= 2) {
printf("\t %d \n",i);
i_count_1++;
}
}
break;
case 1 :
for(i = 1, i_count = 0 ; i <= i_number; i++ ) {
for(j = 1, i_count = 0; j <= i ; j++) {
if( (i % j) == 0 )
++i_count;
}
if(i_count <= 2) {
printf("\t %d \n",i);
i_count_1++;
}
}
}
}
Maxwell Chen
|
|
|
|
|
krish_kumar wrote: But my code is repeating twice ...I wanna avoid that....
No problem. Just put the common code in a function.
"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
|
|
|
|
|
Hi.
I have the following compiler error. The project was once Visual Studio 2003 and it compiled successfully without any problems and worked without a problem. I tried upgrading to Visual Studio 2005, using it's converter. I made one or two changes to get the code to compile and then I get the following problem. The Runtimes are all identical. All are Multi-threads. That has been checked. I´m really really stuck. Can someone please please help me?
Generating Code...
Compiling...
source.c
Compiling resources...
Linking...
uafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in LIBCMT.lib(dllmain.obj)
uafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMT.lib(new.obj)
uafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMT.lib(delete.obj)
uafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) already defined in LIBCMT.lib(new2.obj)
uafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in LIBCMT.lib(delete2.obj)
Library.lib(Export.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(Export.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(Key.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(Key.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(StdAfx.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(StdAfx.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(NameChange.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(NameChange.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(mbConst.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(mbConst.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(Tools.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(Tools.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(OpenedFile.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(OpenedFile.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(ReaderIO.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(ReaderIO.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(WriterIO.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(WriterIO.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(DiskIO.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(DiskIO.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(Data.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(Data.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(DiskSv.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(DiskSv.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(DBSFB.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(DBSFB.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(KCriticalSection.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(KCriticalSection.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(CallbackWnd.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(CallbackWnd.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(KWinThread.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(KWinThread.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(debug_tools.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(debug_tools.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(mbDrvLib.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(mbDrvLib.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(fReadC.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(fReadC.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(mbNameChange.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(mbNameChange.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(DataVerifyer.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(DataVerifyer.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(mbReaderIO.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(mbReaderIO.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(mbOpenedFile.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(mbOpenedFile.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(TBase.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(TBase.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(MDB.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(MDB.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(mbIOcSFB.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(mbIOcSFB.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(mbCDBC.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(mbCDBC.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(KFile.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(KFile.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(ThreadESAR.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(ThreadESAR.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(mbASPI.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(mbASPI.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(mbSPTI.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(mbSPTI.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(mbDBCache.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(mbDBCache.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(Decoder.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(Decoder.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(EDD2Analyzer.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(EDD2Analyzer.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(mbFCLib.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(mbFCLib.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(mbCache.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(mbCache.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(mbFCSFB.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(mbFCSFB.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Library.lib(EDDcfFile.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in atls.lib(atltrace.obj)
Library.lib(EDDcfFile.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in atls.lib(atlbase.obj)
Creating library Release/library.lib and object Release/library.exp
library.exp : warning LNK4070: /OUT:library.DLL directive in .EXP differs from output filename '../Release/library.dll'; ignoring directive
Library.lib(mbFCSFB.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(mbDBCache.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(Debug.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(EDD2.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(mbFCLib.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(TBase.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(MDB.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(mbIOcSFB.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(mbCDBC.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(fReadC.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(mbNameChange.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(mbReaderIO.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(mbOpenedFile.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(Data.obj) : error LNK2019: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ) referenced in function "public: class std::basic_string,class std::allocator > & __thiscall std::basic_string,class std::allocator >::ESAR(unsigned int,unsigned int)" (?ESAR@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z)
Library.lib(DiskSv.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(DBSFB.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(mbDrvLib.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
Library.lib(mbFCSFB.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(mbDBCache.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(Decoder.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(EDD2Analyzer.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(mbFCLib.obj) : error LNK2019: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ) referenced in function _$E1
Library.lib(TBase.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(MDB.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(mbIOcSFB.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(mbCDBC.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(fReadC.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(mbNameChange.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(mbReaderIO.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(mbOpenedFile.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(Data.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(DiskSv.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(DBSFB.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
Library.lib(mbDrvLib.obj) : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
../../Release/library.dll : fatal error LNK1120: 2 unresolved externals
Can someone help me please?
|
|
|
|
|
Hummmm... strange
I am guessing that you were running in debug mode under 2003, and you switch to 2005 but in relase mode. And in this mode you didn't report dependencies or library path
my 2 cents
|
|
|
|
|
Ok thanks. How do I check all of that?
|
|
|
|
|
I' m trying to get a solid grasp on the whole KMDF. The reason for the following doesn't jump out at me immediately, can anyone explain?
When my input program sends the writefile IRP through WriteFile, my driver seems to receive 4 different IRP, 3 of which are unused. Should I be concerned about this? What exactly is happening?
Ohh and while im here, what should I do about the __drv_dispatchType(IRP_MJ_UNUSED) line before my mem_Unused declaration? I just made up IRP_MJ_UNUSED...
DRIVER SRC: (snippet)
DRIVER_INITIALIZE DriverEntry;
DRIVER_UNLOAD DriverUnload;
__drv_dispatchType(IRP_MJ_UNUSED) DRIVER_DISPATCH mem_Unused;
__drv_dispatchType(IRP_MJ_WRITE) DRIVER_DISPATCH mem_Write;
NTSTATUS mem_Write(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
DbgPrint("Write IRP Received\n");
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NO_INCREMENT );
return STATUS_SUCCESS;
}
NTSTATUS mem_Unused(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp )
{
DbgPrint("Un-used IRP Received\n");
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NO_INCREMENT );
return STATUS_NOT_SUPPORTED;
}
INTERFACE INPUT: (snippet)
hFile = CreateFile(L"\\\\.\\Meminterface", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if ( hFile == INVALID_HANDLE_VALUE )
{
printf("FAILED, last error:%i\n",GetLastError());
}
else
{
WriteFile(hFile, "Hello from user mode!", sizeof("Hello from user mode!"), &dwReturn, NULL);
DEBUG OUTPUT:
Un-used IRP Received
Write IRP Received
Un-used IRP Received
Un-used IRP Received
|
|
|
|
|
You might try asking this in the "Hardware and Devices" forum.
What type of driver have you declared yourself to be? A good thing to do is to get the tools from OSR Online, especially the IRP viewer. Very good!!
Judy
Be wary of strong drink. It can make you shoot at tax collectors - and miss.
Lazarus Long, "Time Enough For Love" by Robert A. Heinlein
|
|
|
|
|
Hi,
Is there any way to execute XQuery through MFC Code, I know How to use MSXML.DLL to load xml documents and navigate the XML document But I am looking for a method like ExecuteSQL("") to execute my XQuery statements?
I am in need of knowing that But I can't find anything
|
|
|
|
|
Amir_m wrote: Is there any way to execute XQuery through MFC Code...
How would you do it outside of code?
"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
|
|
|
|
|
With a rusty pipe, strangulation, starvation or torture.
Pretty sure these are all outside of code (well in most countries anyway)
|
|
|
|
|
Code of the Assassin?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
I Think I could make my problem more clear by the following code:
class CMyAppDlg : public CDialog
{
MSXML2::IXMLDOMDocumentPtr m_pXMLDoc;
_RecordsetPtr m_pRs;
....
};
CString fileName(_T("C:\test.xml"));
m_pXMLDoc->load(fileName.AllocSysString());
m_pRs m_pXMLDoc->ExecuteXQuery(_T("My XQuery Statement"));
of course any other solution that gives me a record set of My XQuery will be useful too
|
|
|
|
|
Hi there.
I am required to write an application in C for Unix that does the following:
The program will create 3 child processes which read from 3 different files and write
to the same pipe in the parent process. Each child should wait a random amount of time (3 -10
seconds) between writing each 50 characters. The father should read from the pipe and write
everything he gets (from all 3 files) into one new file.
Here is my Code:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char* argv[])
{
if (argc != 5)
{
printf("Error!\nUsage: tar1.exe <input file 1> <input file 2> <input file 3> <output file>\n");
exit(0);
}
int fd[2];
int fileOpen;
int pids[3];
int i;
char buf[51];
pipe(fd);
close(fd[1]);
for (i=1; i < 4; i++)
{
switch ((pids[i] = fork()))
{
case -1:
printf("Fork error");
break;
case 0:
close(fd[0]);
printf("Child %d created. File: %s\n",i ,argv[i]);
if ((fileOpen = open(argv[i],O_RDONLY)) == -1)
{
printf("File %s does not exist.\n",argv[i]);
exit(0);
}
printf("Child %d writing to pipe\n",i);
while (read(fileOpen,buf,50) > 0)
{
buf[50] = NULL;
printf("Child %d. Text: %s",i,buf);
write(fd[1], buf, 50);
sleep(rand()%8+3);
}
close(fd[1]);
close(fileOpen);
printf("Child %d done writing to pipe\n",i);
exit(0);
break;
default:
break;
}
}
wait();
wait();
wait();
if ((fileOpen = open(argv[4],O_WRONLY)) == -1)
{
printf("File %s does not exist.\n",argv[i]);
exit(0);
}
printf("Father reading from pipe.\n");
while (read(fd[0],buf,50) != 0)
{
printf("Read line...\n");
buf[50] = NULL;
printf(buf);
write(fileOpen, buf, 50);
}
close(fd[0]);
close(fileOpen);
printf("Done reading!\n");
return 0;
}
Running the application results with lots of rubbish in the output file.
Help will be highly appreciated.
Thanks!
|
|
|
|
|
SummerBulb wrote: while (read(fd[0],buf,50) != 0)
{
printf("Read line...\n");
buf[50] = NULL;
printf(buf);
write(fileOpen, buf, 50)
You're assuming the read function return either 0 or 50 . This is a wrong assumption.
BTW Haven't you any synchronization requirement (for instance, it is ok if in the output file the content of the three input files is scrambled?)?
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]
|
|
|
|
|
CPallini wrote: SummerBulb wrote:
while (read(fd[0],buf,50) != 0)
{
printf("Read line...\n");
buf[50] = NULL;
printf(buf);
write(fileOpen, buf, 50)
You're assuming the read function return either 0 or 50. This is a wrong assumption.
I changes the while condition to
while (read(fd[0],buf,50) > 0)
but that is also wrong, of course. If i'm not mistaken, im getting a -1 return for an unknown reason.
Why can't the father read from the pipe?
CPallini wrote: BTW Haven't you any synchronization requirement (for instance, it is ok if in the output file the content of the three input files is scrambled?)?
I tried very hard to find the sync demand int the text, but i couldn't find it...
Thanks!
|
|
|
|
|
You may have, at least, two problems:
read return value is -1.read return value is positive, but less than 50.
When read returns -1 , you've to check errno to understand what happened (in any case you must NOT write (garbage) values to the output file.
When read returns a positive value less than 50 , you should copy just the read bytes to the output file.
For instance
while ( ! finished )
{
ssize nread = read(fd[0],buf,50);
if ( nread == -1 )
{
}
else if (nread > 0)
{
printf("Read %d characters\n", nread);
buf[nread]='\0';
printf(buf);
write(fileOpen, buf, nread);
}
}
where finished is a termination condition (timeout?) that you possibly know better than me.
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]
|
|
|
|
|