We report on a convenient CVD fabrication of the uniform, compact and reproducible g-C3N4 solid films on indium-tin oxide substrates. It is found that mixing quantitative thiourea into melamine as co-precursor prompts the deposition of greenish-yellow, transparent and smooth g-C3N4 thin films. The thiourea apparently affects the crystalline, the surface morphologies and the energy band structures of g-C3N4 films by modulating the polymerization process of the precursors, and simultaneously introduces S dopants into the g-C3N4 films. Due to these roles of thiourea, the obtained S-doped g-C3N4 films as a photoelectrode show a high and stable visible-light-driven photocurrent response. To further improve the photocurrent, the construction of three heterojunction structure types based on g-C3N4 films is proposed and the corresponding charge transfer mechanisms are well discussed. The successful fabrication of high quality g-C3N4 films in this work provides a footstone to construct the heterojunction film structures based on the carbon nitrides for the photoelectrochemical overall water splitting.