|
You do not need CWnd to call ::GetSafeHWnd()
::GetSafeHwnd() is a win32 API
CWnd::GetSafeHWnd is the same but MFC wrapped .
redindian
|
|
|
|
|
Hi Friends,
I am new to this discussion.
I am facing Linker error while building my project.
Error is:Creating library C:\Program Files\Quark\QuarkDDS 4\QuarkDDS\XTension\OptimakerSXT2.lib and object C:\Program Files\Quark\QuarkDDS 4\QuarkDDS\XTension\OptimakerSXT2.exp
LIBCD.lib(wwincrt0.obj) : error LNK2001: unresolved external symbol _wWinMain@16
C:\Program Files\Quark\QuarkDDS 4\QuarkDDS\XTension\OptimakerSXT2.xnt : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
I have done settings like: 1) c/c++ Tab->Preproccessor->WIN32,_DEBUG,_WINDOWS,_MBCS
2) Link-> Output->wWinMainCRTStartup.
Inspite of these settings i am getting Above errors.Anybody knows, please reply me.
|
|
|
|
|
Raghavendra Pise wrote: 2) Link-> Output->wWinMainCRTStartup.
You might wanted to say Link-->Output-->Entry point symbol-->wWinMainCRTStartup
|
|
|
|
|
Hello Prasad,
Yes, I am using this setting in my project,
Link-->Output-->Entry point symbol-->wWinMainCRTStartup, but getting above errors.
I am not sure whether should i use this entry point or some other.If u know plz tell me
Raghavendra Pise
|
|
|
|
|
I think you asked this question yesterday?did you get your answer
|
|
|
|
|
Ya yesterday i asked same question but didn't get solution,
I used thse settings.
Link-->Output-->Entry point symbol-->wWinMainCRTStartup, but getting above errors.
I am not sure whether should i use this entry point(wWinMainCRTStartup) or some other.If u know plz tell me
|
|
|
|
|
See here[^] maybe its some helpful for you
|
|
|
|
|
Why you set 'entry point for UNICODE project' in a non-unicode project ??
We need not explicitly set any entry point sympol for Non-Unicode projects.
Or
If u intend make ur project UNICODE supportable then plz add 'UNICODE,_UNICODE' in c/c++ Tab->Preproccessor
|
|
|
|
|
Thanks for ur feedback.
If i am remove entry point for my project, still i a getting same errors.
Creating library C:\Program Files\Quark\QuarkDDS 4\QuarkDDS\XTension\OptimakerSXT2.lib and object C:\Program Files\Quark\QuarkDDS 4\QuarkDDS\XTension\OptimakerSXT2.exp
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
C:\Program Files\Quark\QuarkDDS 4\QuarkDDS\XTension\OptimakerSXT2.xnt : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
I think i should use some header file to resolve this problem.I already used <windows.h> header file.
Is there any header file, i have to include or any setting i want to do?
|
|
|
|
|
From MSDN:
If you are using Unicode and MFC, you will get an unresolved external on _WinMain@16 if you don’t create an entrypoint to wWinMainCRTStartup. Use the /ENTRY option or type this value in the Project Settings dialog box. (To find this option in the development environment, click Settings on the Project menu, then click the Link tab, and click Output in the Category box.) See Unicode Programming Summary.
See the following Knowledge Base articles located in the Online Information System for more information. An easy way to reach an article is to copy a "Q" number above, open the Search dialog box from the Help menu and select the Query tab, then paste the number into the first text box and press ENTER.
Q125750 "PRB: Error LNK2001: '_WinMain@16': Unresolved External Symbol"
Q131204 "PRB: Wrong Project Selection Causes LNK2001 on _WinMain@16"
Q100639 "Unicode Support in the Microsoft Foundation Class Library"
Truth is the subjection of reality to an individuals perception
|
|
|
|
|
Hi,
Thnaks for your feedback.
Sorry to say this, we are using DLL(BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)) in our project not main or Winmain.
May i know Which entry-point want to use in my project?
|
|
|
|
|
I am using VC++ .NET(8 Version) to build a Dialog based application, however, my
application allows user to input command arguments from the Command prompt
window.
I want to write some help message when user enters "Some.exe /?" at the command prompt. How can I write text to the command prompt window if user enters the above arguments?(Some.exe /?)
|
|
|
|
|
I dont know about .Net, but MFC implements the following:
BOOL CSetupApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CSetupDlg dlg;
m_pMainWnd = &dlg;
if(stricmp(m_lpCmdLine, "-f") == 0)
dlg.ForceInstall = TRUE;
else
dlg.ForceInstall = FALSE;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
for dialog based apps.
ie, there is an inbuilt command line to the app, that you can handle, and choose to create the dialog or, in your case, just print to standard out.
Perhaps .Net has a similar mechanism.
Truth is the subjection of reality to an individuals perception
|
|
|
|
|
hi all,
can anybody help me on Differential Backup policy algorithm?
i want just algorithm for implement it on MFC.
Thanks & Regards
rakesh baldha
|
|
|
|
|
Can you help me to know about the following dlls?
1.NSInst.dll
2.CPUID32.DLL
Actually as per my knowledge these dlls are used during creation
of installer setup file.But I don't know the exact purpose of these
dlls.If you have any resources or site link which can help me in
in this regard then please forward that to me.
With Regards
Neeraj Sinha
Netstudio
Pune
|
|
|
|
|
From where you download these files?
|
|
|
|
|
There are two classes in my case, Class_A and Class_B. In Class_A.h, a Class_B member variable is declared. Hence, #include "Class_B.h" is put into Class_A.h. In Class_B.h, On the other hand, a Class_A member variable is declared. Hence, #include "Class_A.h" is put into Class_B.h.
However, the above arragement will cause C2146, C2501 errors. How to solve this dilemma.
Thanks,
|
|
|
|
|
There's a couple of ways around the circular dependency problem:
a) Put your declarations in .h and put your definitions in .cpp.
b) Declare your classes, then in the same .h, put the definitions with the dependencies outside of the class.
a)
.h:
class Class_A;<br />
class Class_B;<br />
<br />
class Class_A<br />
{<br />
Class_B* _b;<br />
<br />
void func();<br />
};<br />
<br />
class Class_B<br />
{<br />
Class_A* _a;<br />
<br />
void func();<br />
};<br />
.cpp:
void Class_A::func()<br />
{<br />
_b->func();<br />
}<br />
<br />
void Class_B::func()<br />
{<br />
_a->func();<br />
}<br />
b)
.h:
class Class_A;<br />
class Class_B;<br />
<br />
class Class_A<br />
{<br />
Class_B* _b;<br />
<br />
void func();<br />
};<br />
<br />
class Class_B<br />
{<br />
Class_A* _a;<br />
<br />
void func();<br />
};<br />
<br />
<br />
void Class_A::func()<br />
{<br />
_b->func();<br />
}<br />
<br />
void Class_B::func()<br />
{<br />
_a->func();<br />
}<br />
In either case, the classes are declared, then the class functions are defined after they're declared.
-- modified at 2:31 Tuesday 7th November, 2006
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
You certainly meant Class_A* _a and Class_B* _b for the class declaration, no ? Otherwise, if you don't work with pointer this won't work.
|
|
|
|
|
Oops! Yes. That's what I meant. My fingers got going a little too fast on the keyboard.
Thanks!
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
I am a VC/MFC newbie. Why Class_A _a Class_B _b would cause errors. Why we cannot use them as we use 'int' 'float'. Would you please give more details.
Thank you.
|
|
|
|
|
cy163@hotmail.com wrote: Why we cannot use them as we use 'int' 'float'
You don't need to 'define' what an integer is, do you ? Here, with classes, in order to use them, you need to first define them, that is provide all the members of the class (functions and variables). The compiler needs to compute the size of your class whenever you will use it in your code (to allocate memory for it). For that, all the members of the class needs to be known (and also need to know their respective size). If you include one object into a another and vice-versa, you cannot calculate the size, it's like in real life: try to put one container inside another one and then put the latter into the first one, quite tricky isn't it ? So, for the compiler it is the same.
Is you use pointers instead, that is different because a pointer is just an address (so a size of 4 bytes always).
cy163@hotmail.com wrote: I am a VC/MFC newbie
We all started there. But in this case, this is pure C++ (VC and MFC are microsoft and C++ is a standard language).
|
|
|
|
|
Thank you Cederic,
and sorry, I still cannot understand. It is also possible to need to declare interge float type variables in a class, for example,
<br />
class Class_A<br />
{<br />
int i;<br />
<br />
void func();<br />
};<br />
<br />
OR
<br />
class Class_A<br />
{<br />
int *i;<br />
<br />
void func();<br />
};<br />
<br />
<br />
In the above examples, declarations 'int i' and 'int *i' are both ok.
For a Class_B type variable, why 'Class_B b" will cause problem, whereas 'Class_B *b" wouldn't.
-- modified at 18:24 Tuesday 7th November, 2006
|
|
|
|
|
Yes, because in that case an integer is fully defined (you know its size and everything). In your case, if Class_A is declared before Class_B in the file and if it contains a Class_B has member, this Class_B has not been fully defined yet, so it is impossible for the compiler to create the Class_A.
Think of it as my example: try to put a box 1 inside another box 2 and then box 2 inside box 1. This is the same problem here. In the example with your integer, you simply put box 1 (the integer) into box 2 (your class) but your integer doesn't contain your class.
Another example: if you declared Class_A before Class_B in your example and if Class_A does't contain Class_B, then it would be ok:
Class_A
{
public:
Class_A();
~Class_A();
int Test;
};
Class_B
{
public:
Class_B();
~Class_B();
Class_A AnotherTest;
};
This will work because Class_A is fully defined when you use it in Class_B. Now, if you want to use Class_B inside Class_A you cannot do that directly (there is noway you can fully define both classes if they contain each other). The workaround is to use a pointer inside to Class_B inside Class_A: A pointer is always 'known' (its size is always 4 bytes). And you need to use forward declaration of Class_B (it is more or less the same as function prototype but for classes):
class Class_B;
Class_A
{
public:
Class_A();
~Class_A();
int Test;
Class_B* pB;
};
Class_B
{
public:
Class_B();
~Class_B();
Class_A AnotherTest;
};
Is it clearer now ?
|
|
|
|
|
Cedric, I fully unstand the trick now.
Thank you very much.
|
|
|
|