此种Link 的错误该如何解决呢?

java375378563 2008-07-10 11:26:37
请看错误的源代码:

Deleting intermediate files and output files for project 'MFCDemo - Win32 Debug'.
--------------------Configuration: MFCDemo - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
MFCDemo.cpp
MFCDemoDlg.cpp
Generating Code...
Linking...
MFCDemoDlg.obj : error LNK2001: unresolved external symbol _FUNC_FindPhysKey
../Debug/MFCDemo.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

MFCDemo.exe - 2 error(s), 0 warning(s)

此种 Linking 的错误该如何解决呢?之前也解决过这种问题?但是这个问题没有解决是什么原因呢?请教各位了!谢!谢!谢

...全文
98 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
Amuro1987218 2008-07-10
  • 打赏
  • 举报
回复
_FUNC_FindPhysKey 是哪的
kingpang 2008-07-10
  • 打赏
  • 举报
回复
就只有调试信息???
这个是外部的东西无法解析
你看看你#pragma comment(lib, "XXXX.lib")没?
zaodt 2008-07-10
  • 打赏
  • 举报
回复
好像是不能链接 .lib 文件。


楼主是否使用了一些 dll 文件?
jintian_xingqisi 2008-07-10
  • 打赏
  • 举报
回复
这个问题我也遇到过,我现在加了一个群,这个群人气较好,也的确有高手,不但可以交流问题,而且还可以接项目赚钱,QQ群号是:陆`肆`柒`玖`捌`柒`贰`零,不要说我做广告,看看便知,如需要的话加入试试,如果你发现好的交流群也别忘了告诉我啊!呵呵!
java375378563 2008-07-10
  • 打赏
  • 举报
回复
此问题已解决!谢! 谢!谢!
java375378563 2008-07-10
  • 打赏
  • 举报
回复
FUNC_FindPhysKey的lib 加入了进去,

FUNC_FindPhysKey() 是 BaseHSM files 项目中实现的,我把

BaseHSM files 整个加入项目组中,而且,又把需要的 lib 的路径又在
Tools-> Options -> 之中设置了。

但是现在又出现了新的问题如下:

在 BaseHSM files 项目中又要加入 lib 但此 lib 是 KMC 另一个项目的

Lib 那么我想不在项目组中加入 KMC 项目又如何加载 lib 文件 呢?

请指教。谢!谢!谢。


请看如下便是出现的错误异常代码 :


Deleting intermediate files and output files for project 'BaseHSM - Win32 Debug'.
--------------------Configuration: BaseHSM - Win32 Debug--------------------
Compiling...
BaseHSM.c
dercoding.c
expand.c
mem_clr.c
padding.c
tass_log.c
Linking...
LINK : fatal error LNK1104: cannot open file "..\KMC\lib\MYTSSL.lib"
Error executing link.exe.

BaseHSM.dll - 1 error(s), 0 warning(s)
hua_yang 2008-07-10
  • 打赏
  • 举报
回复
在cpp文件开始用:#pragma comment(lib, "XXXX.lib")
或者在Project-->Setting-->...设置也可以
hua_yang 2008-07-10
  • 打赏
  • 举报
回复
FUNC_FindPhysKey的lib是不是没有加
java375378563 2008-07-10
  • 打赏
  • 举报
回复
请看上面的源代码 ,我是引用了.lib 文件 。

MFC 是用工具生成的代码 所以没有

“你看看你#pragma comment(lib, "XXXX.lib")没? ”


FUNC_FindPhysKey()函数是在 BaseHSM.h 头文件 中定义的。但是我引用了,为什么还是出错呢?不解呢?


Tools -> Options ->Directories->
Directories:
E:\GGG\MFCDEMO\lib

求解了各位!谢!谢!谢!
java375378563 2008-07-10
  • 打赏
  • 举报
回复
// MFCDemoDlg.cpp : implementation file
//

#include "stdafx.h"
#include "MFCDemo.h"
#include "MFCDemoDlg.h"
#include "./inc/BaseHSM.h"
#include "openssl/ebcdic.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
CAboutDlg();

// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA

// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMFCDemoDlg dialog

CMFCDemoDlg::CMFCDemoDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMFCDemoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMFCDemoDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CMFCDemoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMFCDemoDlg)
DDX_Control(pDX, IDC_LIST1, m_HSMKeyList);
//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CMFCDemoDlg, CDialog)
//{{AFX_MSG_MAP(CMFCDemoDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMFCDemoDlg message handlers

BOOL CMFCDemoDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// Add "About..." menu item to system menu.

// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

// TODO: Add extra initialization here
m_HSMKeyList.InsertColumn(0,"ID号",LVCFMT_LEFT,40,-1);
m_HSMKeyList.InsertColumn(1,"密钥类型",LVCFMT_LEFT,110,-1);
m_HSMKeyList.InsertColumn(2,"公钥文件",LVCFMT_LEFT,110,-1);
m_HSMKeyList.InsertColumn(3,"私钥文件",LVCFMT_LEFT,110,-1);
m_HSMKeyList.InsertColumn(4,"是否匹配",LVCFMT_LEFT,110,-1);
char buf[200];
for(int i=1;i<33;i++){
sprintf(buf,"%02d",i);
int JustnowItem = m_HSMKeyList.InsertItem(i,buf);

int type;
unsigned char handle[20];
int rc = FUNC_FindPhysKey(i,&type,handle);
if(rc != 0){
continue;
}
char buf[100];
switch(type){
case 1:
sprintf(buf,"DES");
break;
case 2:
sprintf(buf,"DES3");
break;
case 3:
sprintf(buf,"SSF33");
break;
case 4:
sprintf(buf,"PRIVATE");
break;
case 5:
sprintf(buf,"PUBLIC");
break;
default:
sprintf(buf,"UNKNOW");
break;

}
m_HSMKeyList.SetItemText(JustnowItem,1,buf);
}


return TRUE; // return TRUE unless you set the focus to a control
}

void CMFCDemoDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}

// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.

void CMFCDemoDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting

SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;

// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}

// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMFCDemoDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}

void CMFCDemoDlg::OnOK()
{
// TODO: Add extra validation here


MessageBox("确定测试按钮!");
CDialog::OnOK();
}

void CMFCDemoDlg::OnCancel()
{
// TODO: Add extra cleanup here

MessageBox("取消测试按钮!\n");

CDialog::OnCancel();
}

16,473

社区成员

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

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

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