这是什么错啊

sailor11 2005-09-26 02:11:41
Deleting intermediate files and output files for project 'BondBatman - Win32 Debug'.
--------------------Configuration: BondBatman - Win32 Debug--------------------
Compiling...
BondBatman.cpp
Linking...
BondBatman.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CLogHandler::~CLogHandler(void)" (??1CLogHandler@@UAE@XZ)
BondBatman.obj : error LNK2001: unresolved external symbol _WSACleanup@0
BondBatman.obj : error LNK2001: unresolved external symbol "public: static void __cdecl CLogHandler::Flush(void)" (?Flush@CLogHandler@@SAXXZ)
BondBatman.obj : error LNK2001: unresolved external symbol "public: void __thiscall CWorker::ShutDown(void)" (?ShutDown@CWorker@@QAEXXZ)
BondBatman.obj : error LNK2001: unresolved external symbol "public: void __thiscall CLogHandler::Log(class CString,class CString)" (?Log@CLogHandler@@QAEXVCString@@0@Z)
BondBatman.obj : error LNK2001: unresolved external symbol "public: __thiscall CLogHandler::CLogHandler(void)" (??0CLogHandler@@QAE@XZ)
BondBatman.obj : error LNK2001: unresolved external symbol _WSAGetLastError@0
BondBatman.obj : error LNK2001: unresolved external symbol _accept@12
BondBatman.obj : error LNK2001: unresolved external symbol "unsigned int __cdecl SPCreateListenSocket(char const *,unsigned int)" (?SPCreateListenSocket@@YAIPBDI@Z)
BondBatman.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CCfghandler::~CCfghandler(void)" (??1CCfghandler@@UAE@XZ)
BondBatman.obj : error LNK2001: unresolved external symbol _WSAStartup@8
BondBatman.obj : error LNK2001: unresolved external symbol "public: long __thiscall CWorker::Initialize(void)" (?Initialize@CWorker@@QAEJXZ)
BondBatman.obj : error LNK2001: unresolved external symbol "public: __thiscall CWorker::CWorker(int)" (??0CWorker@@QAE@H@Z)
BondBatman.obj : error LNK2001: unresolved external symbol "public: void __thiscall CLogHandler::initialize(class CString)" (?initialize@CLogHandler@@QAEXVCString@@@Z)
BondBatman.obj : error LNK2001: unresolved external symbol "public: class CString __thiscall CCfghandler::GetConfigStr(class CString,class CString)" (?GetConfigStr@CCfghandler@@QAE?AVCString@@V2@0@Z)
BondBatman.obj : error LNK2001: unresolved external symbol "public: int __thiscall CCfghandler::GetConfigInt(class CString,class CString)" (?GetConfigInt@CCfghandler@@QAEHVCString@@0@Z)
BondBatman.obj : error LNK2001: unresolved external symbol "public: void __thiscall CCfghandler::SetCfgFile(char *)" (?SetCfgFile@CCfghandler@@QAEXPAD@Z)
BondBatman.obj : error LNK2001: unresolved external symbol "public: __thiscall CCfghandler::CCfghandler(void)" (??0CCfghandler@@QAE@XZ)
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/BondBatman.exe : fatal error LNK1120: 20 unresolved externals
Error executing link.exe.

BondBatman.exe - 21 error(s), 0 warning(s)
...全文
73 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ssbelle 2005-09-26
  • 打赏
  • 举报
回复
添加进来试试看就知道了
sailor11 2005-09-26
  • 打赏
  • 举报
回复
是不是因为有些.cpp在另一工程里的原因啊?
phoenix96_2000 2005-09-26
  • 打赏
  • 举报
回复

以及要使用多线程来编译
laofang 2005-09-26
  • 打赏
  • 举报
回复
可能和头文件或库文件包含有关,可以看看MSDN的帮助:
Numerous kinds of coding and build errors can cause LNK2001. Several specific causes are listed below, and some have links to more detailed explanations.

Coding Problems

Mismatched case in your code or module-definition (.DEF) file can cause LNK2001. For example, if you named a variable “var1” in one C++ source file and tried to access it as “VAR1” in another, you would receive this error. The solution is to exactly match the case of the symbol in all references.


A project that uses function inlining yet defines the functions in a .CPP file rather than in the header file can cause LNK2001.


If you are using C++, make sure to use extern “C” when calling a C function from a C++ program. By using extern “C” you force the use of the C naming convention. Be aware of compiler switches like /Tp or /Tc that force a file to be compiled as a C (/Tc) or C++ (/Tp) file no matter what the filename extension, or you may get different function names than you expect.


Attempting to reference functions or data that don't have external linkage causes LNK2001. In C++, inline functions and const data have internal linkage unless explicitly specified as extern.


A missing function body or variable will cause LNK2001. Having just a function prototype or extern declaration will allow the compiler to continue without error, but the linker will not be able to resolve your call to an address or reference to a variable because there is no function code or variable space reserved.


Name decoration incorporates the parameters of a function into the final decorated function name. Calling a function with parameter types that do not match those in the function declaration may cause LNK2001.


Incorrectly included prototypes will cause the compiler to expect a function body that is not provided. If you have both a class and non-class implementation of a function F, beware of C++ scope-resolution rules.


When using C++, make sure that you include the implementation of a specific function for a class and not just a prototype in the class definition.


Attempting to call a pure virtual function from the constructor or destructor of an abstract base class will cause LNK2001 since by definition a pure virtual function has no base class implementation.


Only global functions and variables are public.
Functions declared with the static modifier by definition have file scope. Static variables have the same limitation. Trying to access any static variables from outside of the file in which they are declared can result in a compile error or LNK2001.

A variable declared within a function (a local variable) can only be used within the scope of that function.

C++ global constants have static linkage. This is different than C. If you try to use a global constant in C++ in multiple files you get error LNK2001. One alternative is to include the const initializations in a header file and include that header in your .CPP files when necessary, just as if it was a function prototype. Another alternative is to make the variable non-constant and use a constant reference when assessing it.

Compiling and Linking Problems

。。。
ssbelle 2005-09-26
  • 打赏
  • 举报
回复
头文件定义了 cpp文件没有实现 可能原因 cpp文件忘记加到工程里来了

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧