Ask Your Question

Build on windows fails with "/" but works with "\" for /FI compiler option

asked 2013-11-06 03:46:43 -0500

Carand gravatar image

updated 2013-11-08 05:27:50 -0500

berak gravatar image

Hello, I tried to build the most recent version of OpenCV under Windows using Visual Studio 10. Building of core fails with this message: cl : Command line error D8004: '/FI' requires an argument

If I replace the "/" (slash) to "\" (backslash) for the precompiled header file, the build works.

Is this known? How can I work around it?

Regards, Andreas

edit retag flag offensive close merge delete


I have found a work around that I will post tomorrow as the forum does not allow me to answer my own question within 1 day.

Carand gravatar imageCarand ( 2013-11-07 03:30:39 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2013-11-08 05:15:39 -0500

Carand gravatar image

I found out how to work around this problem. The problem is that MS VC is usually able to cope with "/" but it seems to require an absolute path, i.e. a drive letter. One approach would be to somehow get CMAKE to use an absolute path when CMAKE_CURRENT_SOURCE_DIR is used, but I had not sufficient time to find a way to do this. Therefore, I reverted to the ugly hack of modifying the file


by changing line

ocv_add_precompiled_header_to_target(${the_target} "${CMAKE_CURRENT_SOURCE_DIR}/${pch_path}precomp.hpp")


ocv_add_precompiled_header_to_target(${the_target} "C:/${CMAKE_CURRENT_SOURCE_DIR}/${pch_path}precomp.hpp")

Not nice, but it works.

Cheers, Andreas

edit flag offensive delete link more

answered 2018-10-18 10:08:19 -0500

tevz gravatar image

This seems to be a problem when you are accessing source code on local network (shared folders) that start with "//". At least for me was that an issue and when copying source code to computer, it worked well.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2013-11-06 03:46:43 -0500

Seen: 799 times

Last updated: Nov 08 '13