Cannot open file 'python311_d.lib'

how can i fix this

|---|---|---|---|---|---|---|
|Error|LNK1104|cannot open file 'python311_d.lib'|Project|...Project\LINK|1||

this is my code:

#include <Python.h>

int main() {
	Py_Initialize();
		PyRun_SimpleString("print(python trong c++)");
	Py_Finalize();
}

[quote=“Bảo Nguyễn, post:1, topic:32399, username:usersever”]
Py_Initialize(); coding

what’s your mean

python311_d.lib is from the debug version of CPython.

If you look in C:\Python311\libs (or wherever you installed Python) you’ll see python311.lib because it’s the release version of CPython.

If you need python311_d.lib, you’ll need to make a debug build of CPython from the source that’s on GitHub.

When I’m building extensions for CPython, I avoid that problem by making a release version instead, although I do disable optimisations while I’m working on it so that I can single-step through the code more easily.

how can i get License file to build this:
my build log:

4>E:\download\Compressed\cpython-3.11.5\PCbuild\regen.targets(127,5): warning : License file E:\download\Compressed\cpython-3.11.5\externals\libffi-3.4.4\LICENSE is missing
4>E:\download\Compressed\cpython-3.11.5\PCbuild\regen.targets(127,5): warning : License file E:\download\Compressed\cpython-3.11.5\externals\openssl-bin-3.0.9\amd64\LICENSE is missing
4>E:\download\Compressed\cpython-3.11.5\PCbuild\regen.targets(127,5): warning : License file E:\download\Compressed\cpython-3.11.5\externals\tcltk-8.6.12.1\amd64\tcllicense.terms is missing
4>E:\download\Compressed\cpython-3.11.5\PCbuild\regen.targets(127,5): warning : License file E:\download\Compressed\cpython-3.11.5\externals\tcltk-8.6.12.1\amd64\tklicense.terms is missing
4>E:\download\Compressed\cpython-3.11.5\PCbuild\regen.targets(127,5): warning : License file E:\download\Compressed\cpython-3.11.5\externals\tcltk-8.6.12.1\amd64\tixlicense.terms is missing

Those are warnings, not errors, so they shouldn’t affect building CPython.

oh, i found this error

4>  File "E:\download\Compressed\cpython-3.11.5\PC\validate_ucrtbase.py", line 8, in <module>
4>    from ctypes import (c_buffer, POINTER, byref, create_unicode_buffer,
4>  File "E:\download\Compressed\cpython-3.11.5\Lib\ctypes\__init__.py", line 8, in <module>
4>    from _ctypes import Union, Structure, Array
4>ModuleNotFoundError: No module named '_ctypes'

The source for _ctypes is in <path to cpython>/Modules/_ctypes.

how can I fix this?

just undef _DEBUG before include python.h

for example:
#ifdef _DEBUG
#undef _DEBUG
#include <Python.h>
#define _DEBUG
#else
#include <Python.h>
#endif