[英]Unresolved external symbol error, even if function is defined and seen by IDE
using Visual C++ 2008, I am having an "Unresolved external symbol" even if with the IDE I can correctly see both declaration and definition of the function: 使用Visual C ++ 2008,即使使用IDE我可以正确看到函数的声明和定义,我也有一个“无法解析的外部符号”:
The error: 错误:
hook_file.obj : error LNK2001: unresolved external symbol "int __cdecl is_directory_objattr(struct _OBJECT_ATTRIBUTES const *)" (?is_directory_objattr@@YAHPBU_OBJECT_ATTRIBUTES@@@Z)
Relevant code in hook_file.cpp: hook_file.cpp中的相关代码:
#include "misc.h"
void handle_new_file(HANDLE file_handle, const OBJECT_ATTRIBUTES *obj)
{
if(is_directory_objattr(obj) == 0 ) {
// etc.
Declaration in misc.h file: 在misc.h文件中的声明:
BOOL is_directory_objattr(const OBJECT_ATTRIBUTES *obj);
Definition in misc.cpp file: 在misc.cpp文件中的定义:
#include "misc.h"
BOOL is_directory_objattr(const OBJECT_ATTRIBUTES *obj)
{ //function body here }
I really don't get what the linker has to complain here. 我真的没有得到链接器在这里抱怨的内容。
Any idea whats wrong? 知道怎么了吗?
Thanks! 谢谢!
Have you only include one time your header file? 您只包含一次头文件吗?
in misc.h 在misc.h中
#ifndef MISC
#define MISC
...
#endif MISC ?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.