We calculate cross section for production of $D$ mesons and $\Lambda_c$ baryons in proton-proton collisions at the LHC. The cross section for production of $c \bar c$ pairs is calculated
within $k_T$-factorization approach with the Kimber-Martin-Ryskin unintegrated gluon distributions. We show that our approach well describes the $D^0$, $D^+$ and $D_s$ experimental data. We try to understand recent ALICE and LHCb data for $\Lambda_c$ production with the $c \to \Lambda_c$ independent parton fragmentation approach. The Peterson fragmentation functions are used. The $f_{c \to \Lambda_c}$ fragmentation fraction and $\varepsilon_{c}^{\Lambda}$ parameter for $c \to \Lambda_c$ are varied. Although one can agree with the ALICE data using standard estimation of model uncertainties one cannot describe simultaneously the ALICE and the LHCb data with the same set of parameters. The fraction $f_{c \to \Lambda_c}$ neccessary to describe the ALICE data is much larger than the average value obtained from $e^+ e^-$ or $e p$ experiments. It seems very difficult, if not impossible, to understand the ALICE data within the considered independent parton fragmentation scheme.