Page 1 of 1

How to link nasm obj file to gcc linker, into cpp project

Posted: Mon Nov 20, 2023 11:48 am
by Radu

gcc 17.0.2(clang)(msys64)

I have in Project Settings>Pre Build:
E:\CodeLite\proiecte\test\nasm-2.09.10\nasm.exe -f win64 -g E:\CodeLite\proiecte\test\nasm-2.09.10/my_asm.asm

It creates file:
E:\CodeLite\proiecte\test\nasm-2.09.10\my_asm.obj

Build Error:
ld.lld: error: undefined symbol: my_asmz
referenced by main.cpp:12

ObjectsList.txt has only :
../build-Debug/test/main.cpp.o

[ I tried this in Visual Studio 2017 using tutorial: https://www.cs.uaf.edu/2017/fall/cs301/ ... e/nasm_vs/
But there I can't get the debugger to work on the asm file, breakpoints are ignored, error: no symbols have been loaded for this document ( have added -vcv8 )
I posted in the visual studio subreddit, no one answered, if someone has any info how to fix this also ]


Re: How to link nasm obj file to gcc linker, into cpp project

Posted: Tue Nov 28, 2023 6:34 pm
by Jarod42

You don't have rule to make the file generated by prebuild to be part of objects required for application.

Instead of prebuild, you might go in menu Settings/Build Settings...

For your compiler, go in Templates panel
add your asm extension, with associatate build rule.

Finally, add that asm file into your project.