c - 如何用 C 编译 SoLoud 库的演示示例?
问题描述
我计划在我的 C 项目中使用 SoLoud 库 ( https://sol.gfxile.net/soloud/index.html )。我不明白如何编译包含在
/demos/c_test/
使其可执行。
有人可以帮助我了解如何使用 gcc 编译它吗?
解决方案
在 demos/c_test/main.c 中,
我变了:
#include "soloud_c.h"
至
#include "../../include/soloud_c.h"
并编译。但是,编译器会输出以下警告:
gcc -ggdb3 -Wall -Wextra -Wconversion -pedantic -std=gnu11 -c "main.c" -o "main.o" main.c:
In function ‘generate_sample’:
main.c:72:38: warning: conversion from ‘int’ to ‘float’ may change value [-Wconversion]
72 | buf[i] += (((rand() % 1024) - 512) / 512.0f) *
| ^
main.c:75:36: warning: conversion from ‘int’ to ‘float’ may change value [-Wconversion]
75 | float fade = (44100 * 10 - base) / (44100 * 10.0f);
| ^
main.c: In function ‘main’:
main.c:129:14: warning: unused parameter ‘parc’ [-Wunused-parameter]
129 | int main(int parc, char ** pars)
| ~~~~^~~~
main.c:129:28: warning: unused parameter ‘pars’ [-Wunused-parameter]
129 | int main(int parc, char ** pars)
| ~~~~~~~~^~~~
Compilation finished successfully.
注意:我没有费心链接可执行文件,但是,我确实注意到了一些感兴趣的项目。
- 可用的库是 *.dll 文件,因此需要在 Windows 操作系统下编译/链接。
- 在“bin”目录下是库:soloud_x64.dll、soloud_x86.dll 和 SDL2.dll。我不知道您的特定计算机需要包含哪些库
推荐阅读
- oracle - 更新 Oracle 默认配置文件
- java - IntellijIDEA 不显示注释描述
- javascript - 当我扩展 Array 类时,filter() 是错误的
- postgresql - 无法使用 Dropbox 作为 url 在 Heroku 中导入本地 pg_dump
- amazon-web-services - Ansible + AWS EC2 插件 + 用户名 + 动态清单文件上的 ssh 密钥
- wpf - 是否可以使用鼠标滚轮滚动 ScrollViewer 的内容?
- python - Scipy.integrate solve_ivp 的稳定性问题
- c# - ASP.NET Core 中的证书绑定
- bitwise-operators - 检查 0,1 和 1,0 模式是否存在 2 个位集
- javascript - python 等效于 DataView(originalSize.buffer).getUint32(0, true);?