stdafx.h???

Discussion in 'Mac Programming' started by dbwrobel, Jul 4, 2010.

  1. dbwrobel Guest

    Joined:
    May 11, 2010
    #1
    I've received some source code from a student who apparently wrote a program in C++ on Windows/Visual Studio; I've been trying to get it to compile on the mac/xcode however when I do run it, it gives me the error that the header stdafx.h is missing. From Google I've seen this is a header particular to Visual Studio; is there anyway to get this code to compile using another library on the mac (please forgive if I'm missing a lot of things, I'm not very familiar with C++)?

    Thanks,
    Dan
     
  2. larkost macrumors 6502a

    Joined:
    Oct 13, 2007
    #2
    A quick read about that file (I don't do any programming on Windows, so I am only operating on 5 minutes of reading), and is seems that it is a banner header that includes a lot of other things, and is usually used to bring in the precompiled versions of those things (sorry, source material was a bit vague). So it might be that you can just eliminate that header file and you are ok.

    In any event you are going to have to eliminate that reference, and see what else blows up on you. You might run into a whack-a-mole of things that you are going to have to manually import, and it might be that ultimately you are going to find Windows-specific things that you are going to have to code around. You don't talk about what this is exactly, so I can't really guess if this is going to be worth the effort.
     
  3. pilotError macrumors 68020

    pilotError

    Joined:
    Apr 12, 2006
    Location:
    Long Island
    #3
    If it's just standard code (no windowing code), just eliminate it. I agree with the whack-a-mole comment. If there's windowing code in there, its probably not worth your aggravation. :D
     
  4. Sander macrumors 6502

    Joined:
    Apr 24, 2008
    #4
    This is indeed a "magic" header, which is used to speed up compilation via precompiled headers. It's still project-specific though, so your student should have included it when handing in the assignment. It's usually generated by a wizard and contains lots of stuff dependent on the specific Windows version, and you're supposed to include your often-used headers at the bottom.
     

Share This Page