Unreferenced formal parameter while trying to embed in c++

i’m trying to embed python in a c++ program with meson and following python’s embedding docs but when i compile i get the following failure:

[1/2] Compiling C++ object vStudioPlayer.exe.p/main.cpp.obj
FAILED: vStudioPlayer.exe.p/main.cpp.obj
“cl” “-IvStudioPlayer.exe.p” “-I.” “-I…” “-I…\libs\Python-3.12.4\Include” “-I…\libs\Python-3.12.4\PC” “/MDd” “/nologo” “/showIncludes” “/utf-8” “/Zc:__cplusplus” “/W4” “/EHsc” “/std:c++14” “/permissive-” “/Od” “/Zi” “/FdvStudioPlayer.exe.p\main.cpp.pdb” /FovStudioPlayer.exe.p/main.cpp.obj “/c” …/main.cpp
F:\programming\projects\GameThing++\libs\Python-3.12.4\Include\cpython/unicodeobject.h(205): warning C4100: ‘_unused_op’: unreferenced formal parameter
F:\programming\projects\GameThing++\libs\Python-3.12.4\Include\cpython/unicodeobject.h(395): warning C4100: ‘_unused_op’: unreferenced formal parameter
…/main.cpp(18): error C2059: syntax error: ‘{’
…/main.cpp(18): error C2143: syntax error: missing ‘;’ before ‘{’
ninja: build stopped: subcommand failed.

i have ‘Python-3.12.4/Include’ and ‘Python-3.12.4/PC’ as include directories for ‘Python.h’.

These are warnings, and are not causing the failure.

This is an error, and is causing the failure.

It comes from main.cpp, which is presumably your code.

We can’t possibly diagnose your code further than that, without actually seeing it.

1 Like

My guess is that you did not include Python.h as a extern “C” {} section.
Is that it?