Command Line Compile Using Cl.Exe

Compile using CL.exe with different toolset

Just incase someone need it, i was able to solve this isuue. i added this option to cl.exe:

/D \"_USING_V110_SDK71_\"

And also i modified this option:

/SUBSYSTEM:WINDOWS

to

/SUBSYSTEM:WINDOWS,5.01

After the application runs succesfully on windows xp. You might encounter some problems if you are heavily useing crt in your exe, in my exe i only needed CRT to define Tls callbacks, they do not work without CRT, so i guess maybe this is why this worked for me

How to enable unicode when compiling using cl.exe from Visual Studio Build Tools?

Like @Hans Passant stated it the comment, problem was that compiler doesn't recognize my source file as unicode. Saving a file with BOM or adding /source-charset:utf-8 option makes it work correctly. I prefer the second option: cl /source-charset:utf-8 C:\path_to_source\preventShutdown.c kernel32.lib user32.lib /DUNICODE /D_UNICODE /O2 /link /NODEFAULTLIB /ENTRY:wWinMain

How to compile x64 code with Visual Studio in command line?

You need to use a version of the cl.exe compiler which emits x64 code. Which one depends a bit on your setup.

Let's consider the case you're on a 64 bit machine. For this you'll need to use the compiler which lives at

c:\Program Files (x86)\Microsoft visual Studio 10.0\VC\bin\amd64\cl.exe

If you're on a 32 bit machine you'll need to use the cross compiler located at

c:\Program Files\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\cl.exe



Related Topics



Leave a reply



Submit