I'm having a great trouble in compiling a custom header file in my project,

with Visual C++ 6.0, when I open my source files and click builds, every thing goes fine, but when I try to compile header file, I receive following error,

" Cannot compile 'D:\Programs\SalesP.h'; no compile tool is associated with the file extension.."

This error had ruined me.. :( I'll bi very thankful to you to overcome this error......

Thanks Again..

3 Years
Discussion Span
Last Post by xidike

header files are not to be compiled, they are just included in other *.c and *.cpp files.

// some \*.cpp file
#include <iostream>
#include "SalesP.h"

// rest of cpp code goes here

Edited by Ancient Dragon


You have possibly put this file into the Visual Studio configuration file to be compiled, or the problem is that for C++ (especially for pre-compiled headers) it should either not have the .h extension, or should be something like .hh, .hxx, etc.


VS has never recognized anything other than .h extension by default, so I doubt that is the problem. Most likely the .h file was added to the project as a compileable file just like the .cpp files. If that is the case then just simply remove the file from solution. Don't delete it from the file system or project folder, just from VS Solution Explorer window.

Votes + Comments
Thanks AD - I haven't used VS for a LONG time. I'd rather get a good whack upside the head instead! :-)

Thanks for your help guyz, the solution that worked for me was, not to compile the header file, everything went fine, :) Thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.