Solved

C++ Language question

Posted on 1997-07-05
2
231 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What is the real difference between C++ and Visual C++.NET? 7 120
Getting IP address 8 89
No module found pypyodbc, 3 33
How do i run a c++ file? 15 46
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

830 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