Solved

C++ Language question

Posted on 1997-07-05
2
205 Views
Last Modified: 2010-04-10
I have tried to build the following code (NOT generated by app wizard) under VC++ but I encounter linker error. Would you please help me out?
 
// Here are all the code ------------------------------
 
#include <afxwin.h>
 
class box : public CWinApp
{
public:
    box(){}
    BOOL InitInstance();
};
 
BOOL box::InitInstance()
{
    AfxMessageBox("This is a message box.", MB_YESNO|MB_ICONQUESTION);
        return TRUE;
}
 
box theApp;
 
//end ---------------------------------------------
 
The linker errors are :
 
Linking...
nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
libc.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
box.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
box.exe - 4 error(s), 0 warning(s)
 
Thanks a lot.
 
ka ming
 
(END)
0
Comment
Question by:chankm
2 Comments
 
LVL 5

Accepted Solution

by:
yonat earned 0 total points
Comment Utility
Under the Build menu, select Settings.
In the General tab, change the combo box from "Not using MFC" to
"Using MFC as a shared DLL".
Go to the C++ tab. In the combo box, select "Code generation".
Change the combo box at the right from "Single threaded" (or
"Debug single threaded" in the Debug configuration) to "Multi-
threaded DLL" (or "Debug Multithreaded DLL" in the Debug
configuration).

Hope this helps.
0
 

Author Comment

by:chankm
Comment Utility
Could you explain why such simple program need a multithreaded DLL?
By the way, I think yonat's answer is quite good.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now