Swiss Frank
Swiss Frank

Reputation: 2422

Visual Studio: two little projects with identical "Command Lines" but one cannot find the headers?

I have a solution with two one-source-file projects in it. Each file is:

#include <mosquitto.h>

The first compiles fine. The second says it cannot find a header. The source code in the second is identical to the first, so it is a mystery why it cannot compile.

Pre-compiled headers are not being used in either, so it is curious that the /Fp option is issued, I don't see how it can be playing a role.

/permissive- /ifcOutput "x64\Release\" /GS /GL /W3 /Gy /Zc:wchar_t /I"C:\Program Files\mosquitto2.0.14\devel" /Zi /Gm- /Od /sdl /Fd"x64\Release\vc143.pdb" /Zc:inline /fp:precise /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /Oi /MD /FC /Fa"x64\Release\" /EHsc /nologo /Fo"x64\Release\" /Fp"x64\Release\Good.pch" /diagnostics:column 
/permissive- /ifcOutput "x64\Release\" /GS /GL /W3 /Gy /Zc:wchar_t /I"C:\Program Files\mosquitto2.0.14\devel" /Zi /Gm- /O2 /sdl /Fd"x64\Release\vc143.pdb" /Zc:inline /fp:precise /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /Oi /MD /FC /Fa"x64\Release\" /EHsc /nologo /Fo"x64\Release\" /Fp"x64\Release\Bad.pch" /diagnostics:column 

Another user suggests posting the actual failed output.

Build started...
1>------ Build started: Project: Bad, Configuration: Debug x64 ------
1>Bad.cpp
1>T:\MyFirm\dev\MinorProjects\Bad\Bad.cpp(55,10): fatal error C1083: Cannot open include file: 'mosquitto.h': No such file or directory
1>Done building project "Bad.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Upvotes: 0

Views: 73

Answers (1)

Swiss Frank
Swiss Frank

Reputation: 2422

I turned on Tools->Options->Projects and Solutions->Build and Run->verbosity=Detailed, and compared the CL.exe commands issued.

To my surprise, the /I include option was NOT present on the failed build command, despite being in the Properties dialog "Command Line" page as pasted above.

The issue was that I was building in Debug, but for some reason the Properties dialog was editing Release options. So, while the "Command Line" page was showing the options that would be used were I building Release, they weren't used while building Debug.

Upvotes: 2

Related Questions