Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent error

Status
Not open for further replies.

MarcoMB

Programmer
Oct 24, 2006
61
IT
i've lost my project i can't compile it due to following message:


Cannot compile the file "d:\temp\myfile.h"; no compile tool is associated
with the file extension.

how can i solve?
Thanks
 
Sounds like Visual Studio is messed up. Did you try reinstalling?
 
:) No need to reinstall.

You don't compile header files. What are you trying to do?
 
Didn't you occasionally include myfile.h to the list of your project sources?
 
the include files are all included in project but Visual Studio doesn't see and compiles them anymore ...
 
There should be a list of .cpp files, and another list of .h files. Don't mix them up.
 
Visual Studio is not suppose to compile the .h (header) files. That's not how you do it. The header files are included in .cpp (source) files and the source files are all compiled.

Again, what are you trying to do? Are you trying to build your program? Are you trying to compile a specific file to see if it is correct? More details please.
 
i know there are 2 lists one for cpp and one for h files...yes i'm trying to build my project but it doesn't i get a list of strange errors...and if i try to compile a single class the error above appears...
 
Did you understand the part about not compiling header files?

If you want to compile your class declared in a header file, then compile a source file that includes that header file. Usually, a class has a header file with the class declaration and a source file that includes the header file with the member function definitions. To compile the class, you compile the source file. Like this:
Code:
// myclass.h

#ifndef MYCLASS_H
#define MYCLASS_H

class MyClass
{
  double d;
public:
  MyClass();
  double MyMemberFunction();
};

#endif
Code:
// myclass.cpp

#include "myclass.h"

MyClass::MyClass() : d(0.0)
{
}

double MyClass::MyMemberFunction()
{
    d += 5.0;
    return d;
}
Then, to test your class, just compile myclass.cpp.
 
thanks for help, i've solved the problem starting with a new project and importing cpp and h files...the old project probably was corrupted... i'm building a paint graphic app and i've some problems with flickering view, i've some object of type CRectTracker and other simple graphic objects drawed by DC for example pDC->ellipse,pDC->rect ...etc when i move them on view it seems like a strobo light!!! can someone help me? i've heard about CMemDC and BitBlt to create some buffer and separated Device Context, it's the right way to solve the problem? Thanks a lot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top