I am currently playing with the integration of C libraries in vlang. I have created a new project with v new projectname
and downloaded the steamworks-sdk. For the integration I followed the documentation of vlang for the integration of c code. Unfortunately, vlang cannot find the libraries from the sdk when compiling.
My current folder structure looks something like this:
- v.mod
- steam_appid.txt
- src
- main.v
- c
- steamworks
- content of the headers folder public/steam
- libsteam_api.so
- steam_api64.dll
Here is my main.v file:
module main
#flag -I @VMODROOT/c/steamworks
#flag -L @VMODROOT/c/steamworks
#flag linux -L @VMODROOT/c/steamworks/lib/linux64
#flag linux -llibsteam_api.so
#flag windows -L @VMODROOT/c/steamworks/lib/win64
#flag windows -lsteam_api64.dll
//#include "steam_api.h"
fn main() {
println('Hello EternalV!')
// if C.SteamAPI_RestartAppIfNecessary(480) {
// exit(1)
// }
}
The error output when compiling is as follows:
$v run /home/leontutte/Projekte/EternalVLauncher/src
Compilation with unknown C compiler
==================
tcc: error: library 'libsteam_api.so' not found
...
==================
(Use `v -cg` to print the entire error message)
builder error:
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, please report it using `v bug file.v`,
or goto https://github.com/vlang/v/issues/new/choose .
You can also use #help on Discord: https://discord.gg/vlang .
If anybody has an idea just let me know 🙂
I have tried different paths for the libraries, such as in the main directory or directly in the src folder next to the main.v. I have also included the steam_api.h as a test to check my #flag instructions.