stdafx.h and highgui.h

S

silversurfer

Hello world,
I am using linux and os x and tried to compile some c++ sources
(dealing with image processin).

Although many people wrote that the code worked at theirs, I got the
error that the files stdafx.h and highgui.h could not be found (os x
and linux).

How exactly do I have to set up my system in order to be able to use
these classes and what are they there for?

Thanks a lot in advance
Tim
 
S

Scott McPhillips [MVP]

silversurfer said:
Hello world,
I am using linux and os x and tried to compile some c++ sources
(dealing with image processin).

Although many people wrote that the code worked at theirs, I got the
error that the files stdafx.h and highgui.h could not be found (os x
and linux).

How exactly do I have to set up my system in order to be able to use
these classes and what are they there for?

Thanks a lot in advance
Tim

stdafx.h is a placeholder that typically represents all of the
Windows-specific headers, so you may be out of luck on a non-Windows
platform. Take out that #include and see if you get a million more
errors. That would imply the code depends on Windows. Don't know about
the other header.
 
J

Jens Marder

Scott McPhillips said:
stdafx.h is a placeholder that typically represents all of the
Windows-specific headers, so you may be out of luck on a non-Windows
platform. Take out that #include and see if you get a million more
errors. That would imply the code depends on Windows. Don't know about
the other header.

highgui.h: Look at : http://opencvlibrary.sourceforge.net/
stdafx.h: see above. To be more precise:
stdafx.h is used for "MFC"-Programming (Microsoft Foundation Classes).
That is the old Windows GUI Library before WTL and nowadays .NET .
You don't have these headers in Unix or OS X.
You'll need one of the more expensive versions of MS Visual Studio 2005 (for
Win, of course).



Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
 
E

Eric Jensen

stdafx.h is used for "MFC"-Programming (Microsoft Foundation Classes).
That is the old Windows GUI Library before WTL and nowadays .NET .

Eh? stdafx.h is used for precompiled headers. Regardless of MFC/WTL/ect.

In stdafx.h one will place the header files that is often used in ones
program.
Lets say you include the same file in each of your source files (.cpp) then
the compiler will compile the header file each time it compiles a source
file. To save time you can add your includes like windows.h in stdafx.h and
it will be "precompiled" so the compiler do not have to do this each time.

In vc7 and above the precompiled headers is supported so far i know. And you
do not need to use the feature.

If you have a compiler that do not support this, you can still use the
stdafx.h file. It will just not be precompiled, but compiled each time its
included in a source file.

//eric
 
E

Eric Jensen

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently


^^^ Thats the comment VC7 inserts in top of stdafx.h

//eric
 
R

Rolf Magnus

Eric said:
Eh? stdafx.h is used for precompiled headers. Regardless of MFC/WTL/ect.

In stdafx.h one will place the header files that is often used in ones
program.
Lets say you include the same file in each of your source files (.cpp)
then the compiler will compile the header file each time it compiles a
source file. To save time you can add your includes like windows.h in
stdafx.h and it will be "precompiled" so the compiler do not have to do
this each time.

In vc7 and above the precompiled headers is supported so far i know. And
you do not need to use the feature.

If you have a compiler that do not support this, you can still use the
stdafx.h file. It will just not be precompiled, but compiled each time its
included in a source file.

Yes, and in this case, it will have the opposite effect. The compilation
will become much slower, because _all_ the headers #included there will
always be compiled, even those that the current translation unit doesn't
need.
 
J

Jens Marder

Eric Jensen said:
Eh? stdafx.h is used for precompiled headers. Regardless of MFC/WTL/ect.

In stdafx.h one will place the header files that is often used in ones
program.
Lets say you include the same file in each of your source files (.cpp)
then the compiler will compile the header file each time it compiles a
source file. To save time you can add your includes like windows.h in
stdafx.h and it will be "precompiled" so the compiler do not have to do
this each time.

In vc7 and above the precompiled headers is supported so far i know. And
you do not need to use the feature.

If you have a compiler that do not support this, you can still use the
stdafx.h file. It will just not be precompiled, but compiled each time its
included in a source file.

//eric
Really ?? See, for example:
http://en.wikipedia.org/wiki/Stdafx.h

Especially the end of the wikipedia entry.



Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
 
E

Eric Jensen

Really ?? See, for example:
http://en.wikipedia.org/wiki/Stdafx.h

Especially the end of the wikipedia entry.

Yes really. I readed the link wich says whats already written here.

Regarding the end of the wiki entry: "AFX was the original abbreviation for
the Microsoft Foundation Classes (MFC)."

Wich means that "AFX" was the original "short" for MFC. It does not state
that stdafx.h is for MFC only or simular.
However, your post made it sound like stdaxf.h was only intended for MFC,
wich its not.

If you lookup precompiled headers in the msdn library, it does not state
anything about MFC.

//eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top