VS not recompiling when a header changes

Started by
6 comments, last by Endar 15 years, 9 months ago
I'm using boost::spirit to write a simplistic C-like scripting language, and I'm getting issues that when I change the grammar, it doesn't have any effect on the parsing until I re-build the entire project, even though it reports that it re-compiles files. This is the header file (SSLGrammar.h):

class SSLGrammar	:	public boost::spirit::grammar<SSLGrammar>
{
public:

	//! The grammar definition
	template <typename ScannerT>
	struct definition
	{
		// grammar rule object declarations

		//! Define the grammar for the language
		definition(SSLGrammar const& self)
		{
			// grammar rule object declarations

			value_integer = boost::spirit::int_p;
			value_real =	boost::spirit::real_p;

			value =	value_string
				| value_integer
				| value_real
				| value_boolean
				| identifier;
		}
	}

	// function declarations
};





To those who haven't used boost::spirit, 'int_p' is a parser for an integer type and 'real_p' is a parser for a floating point type. The problem I'm having is that when I comment out the | value_integer, I expect that all integers to be parsed as floats and when I uncomment it, integers would be parsed as integers again. Unfortunately this only happens when I re-build the entire project. This is the output I get when I comment out the value_integer and build the project (not a re-build, just a normal build): 1>------ Build started: Project: SimpleScriptingLanguage, Configuration: Debug Win32 ------ 1>Compiling... 1>SSLInterpreter.cpp 1>Generating Code... 1>Compiling... 1>SSLVirtualMachine.cpp 1>c:\programming\simplescriptinglanguage\source\sslvirtualmachine.cpp >>>>> TODO: Load function table. 1>c:\programming\simplescriptinglanguage\source\sslvirtualmachine.cpp >>>>> TODO: Calling an SSL function 1>SSLCompiler.cpp 1>c:\programming\simplescriptinglanguage\source\sslcompiler.cpp >>>>> TODO: Push string onto the stack to represent the variable type. 1>Generating Code... 1>Skipping... (no relevant changes detected) 1>SSLParser.cpp 1>SSLGrammar.cpp 1>Creating library... 1>Build log was saved at "file://c:\Programming\SimpleScriptingLanguage\bin\obj\Debug\BuildLog.htm" 1>SimpleScriptingLanguage - 0 error(s), 0 warning(s) 2>------ Build started: Project: SSL testing framework, Configuration: Debug Win32 ------ Is VS saying that SSLParser.cpp and SSLGrammar.cpp have no changes? What is going on here? Why isn't VS re-compiling all the files that include SSLGrammar.h or the files that include files that include SSLGrammar.h? Edit: I've found that a complete project re-build isn't necessary, I only have to save one of the source files again, not making any changes and re-compile the project. So, this is still a problem, but I don't have to re-build the entire project, just re-compile a single source file.
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper
Advertisement
Is the header file included in the project or is it just finding the file anyway without actually being added to the project?
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
Yep, it is added to the project.
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper
Okay, and which version of VS is it?
Are you using precompiled headers, and is it included in StdAfx.h?
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
Ah, I knew I forgot something. I'm using VS 2005 Express, and I'm not using precompiled headers.
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper
Sounds like turning off "Enable Minimal Rebuild" (/Gm) would fix this. It's in the code generation options on the project. What that tries to do is work out which cpp files are actually affected by header changes and only compile those, but in this case it's getting it wrong.

You might also want to try upgrading to 2008 to see if that bug has been fixed.
You can make MSVC dump header file names to the output as it includes them.

I also find writing "code that has errors on purpose", like "int x[0];" can help make sure you are actually including the file you think you are including.
Quote:Original post by Adam_42
Sounds like turning off "Enable Minimal Rebuild" (/Gm) would fix this. It's in the code generation options on the project. What that tries to do is work out which cpp files are actually affected by header changes and only compile those, but in this case it's getting it wrong.

You might also want to try upgrading to 2008 to see if that bug has been fixed.


Yeah, that fixed it. Any idea why that happens? If it's still compiling only those source files that directly or indirectly inclide SSLGrammar.h, what is the difference to enabling minimal rebuild or not?
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper

This topic is closed to new replies.

Advertisement