How to Convert .i file to .asm with cl.exe

121 Views Asked by At

I have a simple C code like this :

#include <stdio.h>
int main(){   
printf ("this a test");       
return 0;}  

I want convert this code (code.c) to code.i (Preprocessing file) ,so convert code.i to assembly file . for convert code.c to code.i , I use cl /P code.c and get code.i file. but when convert code.i to assembly file whit this command , I have error : cl /Fa code.asm code.i

error :

Microsoft (R) C/C++ Optimizing Compiler Version 19.20.27508.1 for x86 Copyright (C) Microsoft Corporation. All rights reserved.

cl : Command line warning D9024 : unrecognized source file type 'code.as', object file assumed cl : Command line warning D9024 : unrecognized source file type 'code.i', object file assumed Microsoft (R) Incremental Linker Version 14.20.27508.1 Copyright (C) Microsoft Corporation. All rights reserved.

/out:code.exe

code.asm

code.i

LINK : fatal error LNK1181: cannot open input file 'code.asm'

How to convert a .i file to assembly file with cl.exe?

If I use cl /Fa code.i:

cl /Fa code.i Microsoft (R) C/C++ Optimizing Compiler Version 19.20.27508.1 for x86 Copyright (C) Microsoft Corporation. All rights reserved.

cl : Command line warning D9024 : unrecognized source file type 'code.i', object file assumed Microsoft (R) Incremental Linker Version 14.20.27508.1 Copyright (C) Microsoft Corporation. All rights reserved.

/out:code.exe code.i code.i : fatal error LNK1107: invalid or corrupt file: cannot read at 0x321AD

0

There are 0 best solutions below