简体   繁体   English

VS 2015链接器错误,预编译头

[英]VS 2015 linker error, precompiled headers

I am using eclipse cdt with the visual studio 2015 toolchain. 我在Visual Studio 2015工具链中使用Eclipse CDT。 After a lot of tinkering with all the different options and such i have got it almost working with precompiled headers now. 在对所有不同的选项进行了大量修改之后,我现在几乎可以使用预编译的头文件了。 In a prebuild step i create the precompiled header from stdafx.cpp and use it in other files. 在预构建步骤中,我从stdafx.cpp创建预编译的头,并在其他文件中使用它。 Compiling works well, but when it comes to linking i get the following error: Logger.obj : error LNK2011: precompiled object not linked in; image may not run 编译效果很好,但是在链接时出现以下错误: Logger.obj : error LNK2011: precompiled object not linked in; image may not run Logger.obj : error LNK2011: precompiled object not linked in; image may not run

Logger.obj is created from Logger.cpp which is one of my own files and gets compiled in the process. Logger.obj是从Logger.cpp创建的,它是我自己的文件之一,并在此过程中进行了编译。 I figured its probably because the entire Logger class is a template and there is no real code in Logger.cpp, but even trying to use stuff thats included from stdafx.h does not change this. 我认为这可能是因为整个Logger类都是模板,并且Logger.cpp中没有真正的代码,但是即使尝试使用stdafx.h中包含的内容也不会更改此设置。

Does anyone maybe know what the error actually means? 有人知道错误的实际含义吗? I saw some postings when having several libraries, but in my case its actually one of my own files, not from a library. 我有多个图书馆时看到过一些帖子,但就我而言,它实际上是我自己的文件之一,而不是来自图书馆。 I would appreciate any hint! 我将不胜感激!

您需要在要链接的文件列表中包含stdafx.obj(根据我的评论)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM