Problem building a Release

This is a discussion on Problem building a Release within the C++ Programming forums, part of the General Programming Boards category; Thank you. That's what I figured. I wonder why The Shark had it there in the first place - unless ...

  1. #16
    Registered User
    Join Date
    Jun 2006
    Posts
    23
    Thank you. That's what I figured. I wonder why The Shark had it there in the first place - unless the code was from something else (that did need stdafx.h) and he modified it to create an increasing sequence of numbers as a demo for this board.

    As I said, the default on my VC++EE is not to use precompiled headers.

  2. #17
    C++ SharK The SharK's Avatar
    Join Date
    Mar 2004
    Location
    Denmark
    Posts
    62

    Thumbs up

    Hi CondorMan

    I have Visual C++ Express Edition and can't compile this code. It says that stdafx.h does not exist. If I comment out that line, it says that it can't find windows.h.
    I have (now - had) quite the same annoying thing,
    but I could compile the code though.

    But now you mentioned it here, I too now have chosen:
    "Not Using Precompiled Headers"

    But we'll have to remember as Mario F. said:
    On those next projects you come to create, make sure you uncheck the tick box "use precompiled headers" on the project creation screen.
    Thanks for bringing up the subject
    Studying programming languages,
    you'll ALWAYS be a student ;-)

  3. #18
    Registered User
    Join Date
    Jun 2006
    Posts
    23
    An easier way is not to use stdafx.h as it doesn't seem to be needed for your code. As I said, even when I set "Not Using Precompiled Headers" but left the reference to stdafx.h, it still generated the error!

  4. #19
    C++ SharK The SharK's Avatar
    Join Date
    Mar 2004
    Location
    Denmark
    Posts
    62
    Hi ConderMan


    Yes, I see the code doesn't need it obviously.
    When I set "Not Using Precompiled Headers" and leave the reference to stdafx.h it compile fine.

    But the opposite, if I set it to "use Precompiled Headers", and remove the reference to stdafx.h, I get an error !



    regards,


    The SharK
    Studying programming languages,
    you'll ALWAYS be a student ;-)

  5. #20
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581
    If you look inside the stdafx.h file, you will see why the compiler doesn't bother you with any errors.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  6. #21
    C++ SharK The SharK's Avatar
    Join Date
    Mar 2004
    Location
    Denmark
    Posts
    62
    Hi Mario F.

    If you look inside the stdafx.h file, you will see why the compiler doesn't bother you with any errors.
    hmm... what exactly is it I should be seeing/noticeing

    My stdafx.h Header file looks like this:
    Code:
    // stdafx.h : include file for standard system include files,
    // or project specific include files that are used frequently, but
    // are changed infrequently
    //
    
    #pragma once
    
    
    #define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
    #include <stdio.h>
    #include <tchar.h>
    
    
    
    // TODO: reference additional headers your program requires here
    Studying programming languages,
    you'll ALWAYS be a student ;-)

  7. #22
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581
    Well, let's take a look at it...

    #pragma once is a C++ 2005 compiler instruction that replaces the #ifndef and #define pair as header guards. So basically this is simply an header guard to ensure the header is only included once.

    #define WIN32_LEAN_AND_MEAN instructs the compiler to use shorter versions of certain win32 header files, making the code smaller in return.

    So far, none of these directives are capable of producing errors. They are simple instructions to the compiler. Next comes the includes...

    Code:
    #include <stdio.h>
    #include <tchar.h>
    There isn't even the need to analyze these one by one. Suffice to say that all standard and C++ 2005 header files have header guards included. So, even if you used these same headers in your project, they wouldn't be included twice.

    This is why including the stdafx header when "don't use precompiled headers" is turned on, doesn't produce errors. This header file is pretty much innocuous.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Results in Debug and Release mode are different
    By jaro in forum C Programming
    Replies: 11
    Last Post: 05-27-2006, 12:08 PM
  2. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  3. Mesh Release() Problem
    By Morgul in forum Game Programming
    Replies: 6
    Last Post: 03-07-2006, 02:50 PM
  4. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 09:37 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21