Photocatalytic hydrogen (H2) production from water by using solar energy and a photocatalyst is a green and sustainable route to tackle the energy issues. Herein, carbon/g-C3N4 nanocomposites were successfully synthesized via a two-step thermal treatment of urea and glucose with different ratios. As confirmed by X-ray photoelectron spectroscopy, a C-O-C bond was formed between carbon and g-C3N4, which leads to a strong interaction between carbon and g-C3N4. The prepared samples were evaluated for photocatalytic H2 generation under visible light irradiation. The experimental results indicate that the carbon/g-C3N4 nanocomposites show great photocatalytic H2 evolution activity, as high as 410.1 μmol g-1 h-1, which is 13.6-fold of pure g-C3N4. The enhanced photocatalytic performance not only originates from the enlarged surface area and extended visible light response range, but also from the effectively separated photo-generated charge carriers. This spatial charge separation greatly suppresses the recombination of photo-generated hole-electron pairs and facilitates efficient H2 production. This work provides a facile way to design highly efficient carbon nitride-based photocatalysts for potential application in photocatalytic reaction by using solar energy.