- 论坛徽章:
- 0
|
有三个文件。
gg.h, gg.cpp定义了一个gg的类
test.cpp是一个测试gg类的程序
gg.h文件如下
- #include <stdio.h>;
- #include <string.h>;
- #include <stdlib.h>;
- class FtpCmd
- {
- private:
- int port;
- public:
- FtpCmd();
- FtpCmd(int nport);
- };
复制代码
gg.cpp文件如下
- #include "gg.h"
- FtpCmd::FtpCmd()
- {
- }
- FtpCmd::FtpCmd(int nport)
- {
- nport = port;
- }
复制代码
test.cpp文件如下:
- #include "gg.h"
- int main()
- {
- FtpCmd ftp = new FtpCmd(32);
- return 1;
- }
复制代码
为什么编译时老报错:
Linking...
LIBC.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Release/gg.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
gg.exe - 2 error(s), 0 warning(s)
请各位大哥帮忙,谢谢! |
|