Solved

C++ Language question

Posted on 1997-07-05
2
239 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
yonat earned 0 total points
ID: 1164288
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
ID: 1164289
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

710 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