Solution to libctiny and wcrt – LNK2001 unresolved external symbol __chkstk

I’m not sure if any of you ever use libctiny or wcrt, they are both meant to be use with Microsoft Visual Studio so that your resulting binary won’t use the default Microsoft run-time library which slightly bloats the exe.

By using one of these libraries, you can greatly reduce your resulting binary from an average of 20KB to 7KB, depending on your application.

The chkstk problem

The problem arises when the application you just compiled fails to link with an error message: “LNK2001 : unresolved external symbol __chkstk” .

libctiny wcrt chkstk link error

This got to do with the “Ignore all default libraries” option which you’ve to check when using this library. Apparently one library which is required by a routine inserted by the Microsoft tools (chkstk) was excluded from linking as well.

Solution to the problem

Manually include the library! The routine/function is included in an object file named “chkstk.obj”, just put it in the link dialog box beside libctiny/wcrt, and the problem will be settled.

wga fakap #2 chkstk libctiny

I hope that this will solve your problem !

6 Replies to “Solution to libctiny and wcrt – LNK2001 unresolved external symbol __chkstk”

  1. chkstk.obj is not present

    Where it is available.
    and we cannot add .obj file in the additional library text box in the vc settings.

    Prasanna Bhat

Comments are closed.