binary101
binary101

Reputation: 1013

Writing C++ in Xcode 4

I'm trying to learn C++ and I'm not a fan of Windows, therefore using Visual Studio isn't ideal. I have Xcode on my Mac though.

I wrote a program in C++ in Visual Studio and it works fine. When I transfer the code to Xcode (using the c++ tool environment) It still works fine but it doesn't like the top #include statement. Why?

#include "stdafx.h"
#include <stdlib.h>
#include <iostream>
#include <time.h>

Also it still doesn't like it if I use <...> instead of "..." It doesn't affect my current program that I can see.

Basically I'm wondering what its importance is? and do I or will I need it in the future?

Upvotes: 3

Views: 3914

Answers (4)

rubenvb
rubenvb

Reputation: 76721

stdafx.h is Visual Studio's precompiled header helper. Just remove it. Xcode has its own way of doing precompiled headers.

Upvotes: 1

lovaya
lovaya

Reputation: 463

just like this

 #include <stdlib.h>
 #include <iostream>
 #include <time.h>

stdafx.h only exits in vs

Upvotes: 0

Jake Sellers
Jake Sellers

Reputation: 2439

After taking 2 seconds to google "stdafx" it appears it is a header file generated by visual studio. Try removing it. Also try searching for things.

Upvotes: 0

Guillaume
Guillaume

Reputation: 1032

stdafx.h is a windows (visual studio) related header file. Just remove it.

Upvotes: 5

Related Questions