gpt4 book ai didi

c++ - sal.h 不包括在 Path 中

转载 作者:行者123 更新时间:2023-11-28 08:10:46 25 4
gpt4 key购买 nike

我正在努力将 DirectSound 实现到一个程序中,但它需要 dsound.h,而 dsound.h 需要 sal.h,而且无论出于何种原因,我都无法让 g++ 识别我拥有 sal.h,它位于路径文件中,我什至可以直接输入命令 sal.h,命令提示符将打开 sal.h。但是当我编译时

g++-3 World.cpp -c

我明白了

dsound.h:13:17: sal.h: 没有那个文件或目录。

随后由于缺少 sal.h 而导致 dsound.h 出现数千个错误。我只是使用记事本、g++ 和命令提示符,我需要在 VC++ 中才能使 sal.h 工作吗?有没有办法在没有它的情况下使用 DirectSound?

以下是我正在编译的代码的开头部分,以防万一:

#include "WorldEntity.h"
#include "MBox.h"
#include <D3D9.h>
#include <d3dx9.h>
#include <string>
#include <sstream>

#define _USE_MATH_DEFINES
#include <math.h>

#define KEYDOWN(vk_code)((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEYUP(vk_code)((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)

using namespace std;

World::World()
{
//Etc

这是 WorldEntity.h 的开头,包含 dsound.h 的包含文件:

#ifndef WORLDENTITY_H
#define WORLDENTITY_H

class Entity;
class HUD;

#include "Enums.h"

#include "Object.h"
#include "Inventory.h"
#include "AI.h"
#include "Item.h"
#include "Sector.h"
#include "MBox.h"
#include "Particle.h"
#include "Sprite.h"
#include <windows.h>
#include <windows.h>
#include <mmsystem.h>
#include <mmreg.h>
#include <dsound.h>
#include <string>
#include <D3D9.h>
#include <d3dx9.h>
#include <cstdlib>
#include <ctime>

using namespace std;

enum FontIndex
{
//Etc

最佳答案

命令路径包含路径 不同。您必须将 -I 标志添加到 GCC 以告诉它在哪里可以找到头文件:

g++-3 -IC:\some\path World.cpp -c

关于c++ - sal.h 不包括在 Path 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9154848/

25 4 0
文章推荐: c++ - 使用 fread 读取二进制文件时无法获得正确的元素数
文章推荐: ios - swift3 uitableView 重新加载使屏幕闪烁
文章推荐: javascript - 如何通过观察其他