简体   繁体   中英

Why Visual C++ compiler compiles unused classes into executable?

我可能会误解编译器的工作方式,但是我遇到以下情况。我有一个VC ++ 2012项目。该项目包含具有数百个类的API。现在,我创建了“ main”入口点文件,其中仅使用了一些std的东西。主要的甚至不包含来自API的单个标头,但是当我编译时,我看到API的几乎所有内容都被编译为可执行文件了,为什么会发生,这是我应该在项目属性中配置的东西吗?

Source files that are part of the project are compiled also if "unused" through headers and references from your main routine.

If you don't want those compiled simply remove them from the project. The compiler might be able to optimize everything away but that doesn't mean they're not compiled if part of the project first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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