Solved

C++ Language question

Posted on 1997-07-05
2
241 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

624 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