我在VC ++ 2008中遇到了我的程序问题。 编译时,会列出以下错误。我花了很多钱 在groups.google.com上查找原因的时间,但没有评论 帮助过我。有人知道问题是什么吗? 感谢。
error LNK2001: unresolved external symbol "long rfl_xref_id" (?rfl_xref_id@@3JA)
error LNK2001: unresolved external symbol "struct obj_name * pat_objname_list" (?pat_objname_list@@3PAUobj_name@@A)
error LNK2001: unresolved external symbol "struct obj_name * pat_recall_objname_list" (?pat_recall_objname_list@@3PAUobj_name@@A)
error LNK2001: unresolved external symbol "wchar_t * rfl_unresolved_xref_tag" (?rfl_unresolved_xref_tag@@3PA_WA)
error LNK2001: unresolved external symbol "struct ref_pages * rfl_pages" (?rfl_pages@@3PAUref_pages@@A)
error LNK2001: unresolved external symbol "short rfl_use_regen_id" (?rfl_use_regen_id@@3FA)
error LNK2001: unresolved external symbol "long rfl_regen_id" (?rfl_regen_id@@3JA)
error LNK2001: unresolved external symbol "unsigned short rfl_list_status" (?rfl_list_status@@3GA)
error LNK2001: unresolved external symbol "unsigned short rfl_inst_hdr_page" (?rfl_inst_hdr_page@@3GA)
error LNK2001: unresolved external symbol "unsigned short rfl_inst_hdr_ptr" (?rfl_inst_hdr_ptr@@3GA)
error LNK2001: unresolved external symbol "unsigned short rfl_inst_obj" (?rfl_inst_obj@@3GA)
error LNK2001: unresolved external symbol "short rfl_instance_level" (?rfl_instance_level@@3FA)
error LNK2001: unresolved external symbol "short rfl_access_mode" (?rfl_access_mode@@3FA)
error LNK2001: unresolved external symbol "long rfl_select_ref_offset" (?rfl_select_ref_offset@@3JA)
error LNK2001: unresolved external symbol "long rfl_edit_ref_id" (?rfl_edit_ref_id@@3JA)
error LNK2001: unresolved external symbol "long rfl_add_att_offset" (?rfl_add_att_offset@@3JA)
error LNK2001: unresolved external symbol "short rfl_adding_ent_data" (?rfl_adding_ent_data@@3FA)
error LNK2001: unresolved external symbol "long rfl_xref_def_inst_ukey" (?rfl_xref_def_inst_ukey@@3JA)
error LNK2001: unresolved external symbol "long rfl_xref_def_ukey" (?rfl_xref_def_ukey@@3JA)
error LNK2001: unresolved external symbol "long rfl_instance_ukey" (?rfl_instance_ukey@@3JA)
error LNK2001: unresolved external symbol "long rfl_ref_id" (?rfl_ref_id@@3JA)
error LNK2001: unresolved external symbol "unsigned short rfl_next_page_num" (?rfl_next_page_num@@3GA)
error LNK2001: unresolved external symbol "unsigned short rfl_num_pages" (?rfl_num_pages@@3GA)
error LNK2001: unresolved external symbol "unsigned short rfl_page_size" (?rfl_page_size@@3GA)
error LNK2001: unresolved external symbol "struct ref_pages * rfl_cur_page" (?rfl_cur_page@@3PAUref_pages@@A)
error LNK2001: unresolved external symbol "struct ref_def_map * rfl_recall_map" (?rfl_recall_map@@3PAUref_def_map@@A)
error LNK2001: unresolved external symbol "struct ref_xref_image * rfl_image_list" (?rfl_image_list@@3PAUref_xref_image@@A)
error LNK2001: unresolved external symbol "struct ref_xref_refresh * rfl_refresh_info" (?rfl_refresh_info@@3PAUref_xref_refresh@@A)
error LNK2001: unresolved external symbol "short * rfl_form_status" (?rfl_form_status@@3PAFA)
error LNK2001: unresolved external symbol "short rfl_num_forms" (?rfl_num_forms@@3FA)
error LNK2001: unresolved external symbol "long rfl_recall_start_id" (?rfl_recall_start_id@@3JA)
error LNK2001: unresolved external symbol "long rfl_recall_end_id" (?rfl_recall_end_id@@3JA)
error LNK2001: unresolved external symbol "struct ref_pages rfl_begin_add_page" (?rfl_begin_add_page@@3Uref_pages@@A)
error LNK2001: unresolved external symbol "long rfl_add_length" (?rfl_add_length@@3JA)
error LNK2001: unresolved external symbol "struct ref_pages rfl_found_page" (?rfl_found_page@@3Uref_pages@@A)
error LNK2001: unresolved external symbol "short rfl_scan_status" (?rfl_scan_status@@3FA)
error LNK2001: unresolved external symbol "struct ref_pages rfl_scan_info" (?rfl_scan_info@@3Uref_pages@@A)
error LNK2001: unresolved external symbol "struct ref_recall_xrefs * rfl_xref_list" (?rfl_xref_list@@3PAUref_recall_xrefs@@A)
error LNK2001: unresolved external symbol "struct ref_xref_image * rfl_recall_image_list" (?rfl_recall_image_list@@3PAUref_xref_image@@A)
error LNK2001: unresolved external symbol "struct ref_xref_image * rfl_found_image" (?rfl_found_image@@3PAUref_xref_image@@A)
我已经包含了“intdef.h”文件,其中包含了所有上述外部符号的定义。 Intdef.h包含:
extern struct ref_pages *rfl_pages;
extern struct ref_pages *rfl_cur_page;
extern struct ref_pages rfl_begin_add_page;
extern struct ref_pages rfl_scan_info;
extern struct ref_pages rfl_found_page;
extern struct ref_def_map *rfl_recall_map;
extern struct ref_select_info *rfl_select;
extern struct ref_recall_xrefs *rfl_xref_list;
extern struct ref_xref_image *rfl_image_list;
extern struct ref_xref_image *rfl_found_image;
extern struct ref_xref_image *rfl_recall_image_list;
extern struct ref_xref_refresh *rfl_refresh_info;
extern unsigned short rfl_page_size;
extern unsigned short rfl_num_pages;
extern unsigned short rfl_next_page_num;
extern unsigned short rfl_inst_obj;
extern unsigned short rfl_inst_hdr_ptr;
extern unsigned short rfl_inst_hdr_page;
extern unsigned short rfl_list_status;
extern short rfl_adding_ent_data;
extern short rfl_scan_status;
extern short rfl_access_mode;
extern short rfl_instance_level;
extern short rfl_redraw_layer;
extern long rfl_add_length;
extern long rfl_ref_id;
extern long rfl_edit_ref_id;
extern long rfl_recall_start_id;
extern long rfl_recall_end_id;
extern long rfl_import_ref_id;
extern long rfl_import_xref_id;
extern long rfl_xref_id;
extern long rfl_instance_ukey;
extern long rfl_xref_def_ukey;
extern long rfl_xref_def_inst_ukey;
extern long rfl_add_att_offset;
extern long rfl_select_ref_offset;
extern long rfl_regen_id;
extern double *rfl_extents;
extern _TCHAR **rfl_ref_names;
extern short rfl_use_regen_id;
extern short rfl_ref_cntr;
extern short rfl_num_forms;
extern short *rfl_form_status;
extern _TCHAR *rfl_xref_fpath;
extern _TCHAR *rfl_xref_name;
extern _TCHAR *rfl_xref_ref_name;
extern _TCHAR *rfl_xref_ref_label;
extern _TCHAR *rfl_unresolved_xref_tag;
extern _TCHAR rfl_tran_is_iso;
extern _TCHAR rfl_doing_area;
extern int rfl_nv;
extern double *rfl_ar;
extern short rfl_regen_xref_mode;
答案 0 :(得分:5)
我认为问题在于'extern'关键字。该关键字指定在代码中的其他位置声明这些值。也许您错过了另一个要编译的.c / .cpp文件,其中包含这些变量的声明。同样,您包含此头文件实际上并不是定义任何变量 - 它只是要求它们存在于其他地方!
答案 1 :(得分:3)
您已包含标题但未包含所需的库(这些extern对象的实现)。
这是什么图书馆?你是从网上下载的(一些开源的)吗?如果是,请检查该网站是否有.lib文件(库)答案 2 :(得分:1)
我只是想把它扔给那些可能在将来偶然发现这篇文章的人。
在工作中我正在将项目从vs2010(或更高版本)升级到vs2012,我在其中一个项目中遇到了这个错误。出于某种原因,我决定在Linker中重新安排我的附加依赖项 - >输入 - >额外的依赖关系,它修复了我的错误。
我不知道从2010年到2012年链接器发生了哪些变化,但显然它需要重新排列我所依赖的.lib。
这可能不常见,但是如果您遇到此问题并且存在许多外部依赖项,则可以轻松尝试:只需将引发此错误的依赖项放到列表的末尾并重新构建项目
希望有一天这会帮助某人!快乐的编码!
答案 3 :(得分:0)
使用windows ras api时遇到了类似的问题。通过添加合适的#pragma comment来解决该问题。
答案 4 :(得分:0)
你应该看看帖子“什么是未定义的参考/未解决的外部符号错误以及如何修复它?”
对未解析的外部符号有很好的解释,并提供有关如何解决错误的一步一步的调试技巧。