标签: precompiled-headers

如何修复构建中缺少的.pch文件?

当我在Visual Studio中构建我的c ++解决方案时,它会抱怨缺少xxxxx.pch文件.是否有一个我缺少的设置来获取预编译的头文件?

这是完整性的确切错误:

Error   1   fatal error C1083: Cannot open precompiled header file: 'Debug\xxxxx.pch': No such file or directory
Run Code Online (Sandbox Code Playgroud)

c++ precompiled-headers pch visual-studio

152
推荐指数
4
解决办法
14万
查看次数

如何修复PCH错误?

当我尝试构建我的应用程序时Xcode,我收到此错误消息:

PCH文件由不同的分支构建((clang-425.0.24))而不是编译器((clang-425.0.27))

它不会发生,但这是更新Xcode后的第一个版本.

其他应用程序可以使用,但不是特定的应用程

如果我关闭"Precompile Prefix Header"设置,它可以工作.

如何修复此错误并仍然保持该设置?

xcode clang precompiled-headers

126
推荐指数
11
解决办法
5万
查看次数

使用CMake预编译的头文件

我在网上看到了一些关于在CMake中对预编译头文件进行黑客攻击的一些(旧)帖子.它们看起来都有点遍布整个地方,每个人都有自己的方式.目前最好的方法是什么?

c++ gcc cmake precompiled-headers visual-studio

99
推荐指数
8
解决办法
6万
查看次数

带有GCC的预编译头文件

任何人都有成功的预编译头与GCC一起工作?我的尝试没有运气,我没有看到很多关于如何设置它的好例子.我已经尝试过cygwin gcc 3.4.4并在Ubuntu上使用4.0.

c++ gcc precompiled-headers

90
推荐指数
5
解决办法
6万
查看次数

意外的文件结束错误

我希望你能帮助我,因为我不知道发生了什么.我在尝试将Beecrypt库添加到我的项目时遇到以下错误:

致命错误C1010:查找预编译头时意外结束文件.你忘了在你的来源添加'#include"stdafx.h"'吗?

其实我没有忘记将#include"stdafx"添加到我的源代码中.编译器将错误指向此.cxx文件的末尾:

#define BEECRYPT_CXX_DLL_EXPORT

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "beecrypt/c++/security/SecureRandom.h"
#include "beecrypt/c++/security/SecureRandomSpi.h"
#include "beecrypt/c++/security/Security.h"

using namespace beecrypt::security;

SecureRandom* SecureRandom::getInstance(const String& algorithm) throw       (NoSuchAlgorithmException)
 {
Security::spi* tmp = Security::getSpi(algorithm, "SecureRandom");

assert(dynamic_cast<SecureRandomSpi*>(tmp->cspi));

SecureRandom* result = new SecureRandom(reinterpret_cast<SecureRandomSpi*>(tmp->cspi), tmp->prov, tmp->name);

delete tmp;

return result;
}

 SecureRandom* SecureRandom::getInstance(const String& type, const String& provider) throw (NoSuchAlgorithmException, NoSuchProviderException)
  {
Security::spi* tmp = Security::getSpi(type, "SecureRandom", provider);

assert(dynamic_cast<SecureRandomSpi*>(tmp->cspi));

SecureRandom* result = new SecureRandom(reinterpret_cast<SecureRandomSpi*>(tmp->cspi), tmp->prov, tmp->name);

delete tmp;

return result;
    }

   SecureRandom* SecureRandom::getInstance(const String& type, const …
Run Code Online (Sandbox Code Playgroud)

c++ compiler-errors precompiled-headers visual-studio-2008 visual-c++

53
推荐指数
6
解决办法
11万
查看次数

编译C++项目中不使用预编译头文件的C文件?

我可以在C++项目中禁用.c文件的预编译头吗?

当我想将.C文件添加到我的程序中以获取C语言中的脚本虚拟/抽象机器时,我遇到了这些错误:

错误1错误C1853:'Release\pluginsa.pch'预编译头文件来自以前版本的编译器,或者预编译头是C++,您从C使用它(反之亦然)Z:\ Profile\Rafal\Desktop\samod\source\amx\amx.c 1 1 pluginsa

所有其他东西都是C++并使用我的预编译头.

c c++ compiler-errors precompiled-headers visual-c++

43
推荐指数
1
解决办法
4万
查看次数

为什么使用预编译头(C/C++)?

快速提问 - 为什么要使用预编译标题?

编辑:阅读回复,我怀疑我一直在做的事情有点愚蠢:

#pragma once

// Defines used for production versions

#ifndef PRODUCTION
#define eMsg(x) (x) // Show error messages
#define eAsciiMsg(x) (x)
#else
#define eMsg(x) (L"") // Don't show error messages
#define eAsciiMsg(x) ("")
#endif // PRODUCTION

#include "targetver.h"
#include "version.h"

// Enable "unsafe", but much faster string functions
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS

// Standard includes
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <direct.h>
#include <cstring>
#ifdef _DEBUG
#include <cstdlib>
#endif

// Standard Template Library
#include <bitset>
#include …
Run Code Online (Sandbox Code Playgroud)

c++ precompiled-headers

42
推荐指数
5
解决办法
3万
查看次数

在Visual Studio中的项目之间共享预编译的标头

我有一个包含许多Visual C++项目的解决方案,所有这些项目都使用PCH,但有些项目具有特定的编译器开关以满足项目特定的需求.

大多数这些项目在各自的stdafx.h(STL,boost等)中共享相同的头文件集.我想知道是否可以在项目之间共享PCH,这样我就可以拥有一个普通的PCH而不是编译每个项目的PCH,解决方案中的大多数项目都可以使用.

似乎可以将PCH的位置指定为项目设置中的共享位置,因此我有预感这可行.我还假设所有使用共享PCH的项目中的所有源文件都必须具有相同的编译器设置,否则编译器会抱怨PCH与正在编译的源文件之间的不一致.

有没人试过这个?它有用吗?

一个相关的问题:这样的碎片PCH应该过于包容,还是会损害整体构建时间?例如,共享PCH可能包含许多广泛使用的STL标头,但某些项目可能只需要<string><vector>.当优化器必须丢弃由PCH拖入项目的所有未使用的东西时,使用共享PCH节省的时间是否必须在构建过程的稍后时间回收?

c++ precompiled-headers pch visual-c++

41
推荐指数
4
解决办法
1万
查看次数

在预编译头中放什么?(MSVC)

预编译头文件的最佳候选者是什么?我可以在那里放置STL和Boost标头,即使它们有模板吗?这会减少编译时间吗?另外,减少编译时间的最佳IDE设置是什么?

c++ precompiled-headers visual-c++

38
推荐指数
2
解决办法
9213
查看次数

stdafx.h的目的

该文件的目的是stdafx.h什么,预编译头文件的含义是什么?

c++ precompiled-headers stdafx.h visual-c++

38
推荐指数
3
解决办法
2万
查看次数