We give an algorithm for constructing linear network error-correcting codes that achieve the Singleton bound for network error-correcting codes. The proposed algorithm is based on the algorithm by Jaggi et al. We also clarify the relationship between the robust network coding and the network error-correcting codes with known locations of errors.