stdafx.h and highgui.h

Discussion in 'C++' started by silversurfer, Jun 25, 2006.

  1. silversurfer

    silversurfer Guest

    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
     
    silversurfer, Jun 25, 2006
    #1
    1. Advertising

  2. silversurfer wrote:
    > 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.

    --
    Scott McPhillips [VC++ MVP]
     
    Scott McPhillips [MVP], Jun 25, 2006
    #2
    1. Advertising

  3. silversurfer

    Jens Marder Guest

    "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> schrieb im Newsbeitrag
    news:eek:...
    > silversurfer wrote:
    >> 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.
    >
    > --
    > Scott McPhillips [VC++ MVP]
    >


    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
     
    Jens Marder, Jun 25, 2006
    #3
  4. silversurfer

    Eric Jensen Guest

    "Jens Marder" <> wrote in message
    news:449f074b$...

    > 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
     
    Eric Jensen, Jun 26, 2006
    #4
  5. silversurfer

    Eric Jensen Guest

    // 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
     
    Eric Jensen, Jun 26, 2006
    #5
  6. silversurfer

    Rolf Magnus Guest

    Eric Jensen wrote:

    >
    > "Jens Marder" <> wrote in message
    > news:449f074b$...
    >
    >> 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.


    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.
     
    Rolf Magnus, Jun 26, 2006
    #6
  7. silversurfer

    Jens Marder Guest

    "Eric Jensen" <> schrieb im Newsbeitrag
    news:449f9459$0$90445$...
    >
    > "Jens Marder" <> wrote in message
    > news:449f074b$...
    >
    >> 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
    >
    >

    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
     
    Jens Marder, Jun 26, 2006
    #7
  8. silversurfer

    Eric Jensen Guest


    > 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
     
    Eric Jensen, Jun 26, 2006
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nut Cracker
    Replies:
    1
    Views:
    358
  2. jakk
    Replies:
    4
    Views:
    12,603
  3. Tim Meagher
    Replies:
    8
    Views:
    1,311
    Karl Seguin
    Jun 18, 2005
  4. Darren
    Replies:
    3
    Views:
    4,791
    DHOLLINGSWORTH2
    Mar 12, 2005
  5. titi

    if and and vs if and,and

    titi, Mar 9, 2007, in forum: VHDL
    Replies:
    4
    Views:
    624
    Mike Treseler
    Mar 11, 2007
Loading...

Share This Page