C ++ - 清除后未解决的外部符号错误 [英] C++ - Unresolved external symbol error after clean

查看:228
本文介绍了C ++ - 清除后未解决的外部符号错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2010上有c ++项目。我有一个文件A.h,它有一些函数的原型,而A.cpp文件有这些函数的定义。此外,main.cpp文件包括main方法,并包括A.h.一切都在没有任何类的全局命名空间。在我清理项目和构建它给我错误LNK2019:未解决的外部符号为A.h中定义的函数,并在main.cpp中引用。然后我添加一些空间到一个文件(以确保visual studio将编译因为更改),然后编译和错误消失。如何解决这个问题?

I have c++ project on Visual Studio 2010. I have a file A.h which has the prototypes of some functions and A.cpp file has the definitions of these functions. Also, main.cpp file includes the main method and includes the A.h. Everything is in global namespace without any classes. After I clean the project and build it gives me "error LNK2019: unresolved external symbol" for the functions defined in A.h and referenced in main.cpp. Then I add some space to a file(to make sure visual studio will compile because of the change), then compile and the errors disappear. How can I fix this?

推荐答案

我有时会发现预编译的标头不同步,所以我通常会关闭该选项。

I sometimes find that the precompiled headers get out of sync, so I normally turn off that option.

在项目 - >属性 - >配置属性 - > C / C ++ - >预编译头 - >创建/使用预编译头。

It's in Projects->Properties->Configuration Properties->C/C++->Precompiled Headers-> Create/Use Precompiled Header.

这篇关于C ++ - 清除后未解决的外部符号错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆