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..

Recommended Answers

All 4 Replies

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

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.

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.