lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 2021/10/17 5:00, Kaz wrote:
>> [...] I'm not sure I understand your problem properly, what do you mean by "C script" and "calls the header files"?[...]
> 
>  
> 
> Most of the app’s source files are Lua files, but one is .c. The file written in C has a bunch of “#include” statements like #include “iup.h” and it contains some global variables. The actual app code, beyond setting up includes and some globals, is in the Lua files.
> 
> 

if the app contains only 1 single C source file, it should be really easy to set up the toolchain and editor.

please refer to the example in my previous post.

feel free to reach me off list if you have trouble understanding the instructions.

> 
> I’ve since downloaded and installed the .h header files for Lua 5.1 (the app uses this version and the code uses “getn” a lot, which was depreciated in later versions of Lua), IUP, CD, and IM like in the Makefile included in the app’s source files, added the “include” and “Lua51” directories to the “path” section of Environment Variables, but VSCode still can’t find them. 
> 
> 

you need the correct development packages to be able to build, not just the 'header files'. also you need to
configure the tools correctly, including vscode the editor, not only the Makefile.
 
> 
>> [...] what are you trying to debug, your app's source code (in C/C++) or the Lua code that run inside your host app?
> 
> VSCode [...]
> 
> I  don’t know which one I’m supposed to debug. I’m just trying to get VSCode to do something right and find the .h files. I tried using debug on the C file, but that didn’t work. I tried running the app’s main Lua file with the iuplua interpreter but that gives me errors too. I tried to compile, but that doesn’t work. I tried using the app’s Makefile after making some adjustments (the folder structures of the library files I downloaded weren’t the same. There were no folders called “lib”), but nothing can find the .h files.
> 

you can use vscode (togother with gdb from mingw toolchain) to debug C/C++ code, but you need to have debugging
functionality built into your app via Lua debug API in order to debug Lua code.

a correct Makefile will help you build the program, but, AFAIK, vscode still need to be configured manually to
be able to use the debugger integrated within vscode.
 
> 
>> [...] if your app contains native code, you should use the library packages, either static or dynamic, but not the binary ones. [..] 
> 
> The C file contains #include <windows.h>. Does that mean it contains “native code”?
> 

by native code, I simply mean a program with C/C++ source files (instead of pure Lua files).