Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

C++ Language question

Posted on 1997-07-05
2
Medium Priority
?
248 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
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

879 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