NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: mark allyn on August 07, 2009, 03:05:44 PM
-
Hi everyone:
If I type in fom the command line the following two lines, all is well:
nasm -f win32 --prefix _ -o hw.obj hw.asm
gcc -o hw.exe hw.obj
The code assembles, links, and runs.
HOWEVER,
if i put the two lines into a makefile thusly
hw.exe : hw.obj
gcc -o hw.exe hw.obj
hw.obj : hw.asm
nasm -f win32 --prefix _ -o hw.obj hw.asm
make.exe fails in the ld. The message back says: ld:cannot find -lgcc.
Now, interpret this to mean that make is telling me that it can't find some gcc file in a library.
!. What is the correct code for the gcc step in the makefile? 2. Why does everything work fine from the command line, and then fould up in the makefile.
Thanks,
Mark Allyn
-
Hello everyone -
I fixed my own problem and wanted to let others know how to do it.
For whatever reason, the makefile gcc command needs to have an L switch set (the command line version doesn't). Here's what it needs to look like:
gcc -Lc:\MinGW\lib\gcc-lib\mingw32\3.2 -o hw.exe hw.obj
Nathan or Frank: why the difference between command line and makefile? If you have a moment, would be nice to know.
Ciao
Mark Allyn
-
My theory is that the make utility doesn't pass-on its environment when it launches the gcc command as a separate process. Therefore, gcc can't see the default environment variable setting so it must look at the commandline parameter to find the correct path.
Nathan.
-
http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx (http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx)