Reputation: 9
i just started learning c++ lately and i am using visual studio 2015. But i have to manually remove the #include stdafx.h in my cpp file before upload it to the test server for my class, or it just sends back an error like this:the error from test server
I would like to know why this issue is happening. My guess is that this thing is exclusive to windows and x86 based OS? Any help would be appreciated. :D
Upvotes: 0
Views: 3905
Reputation: 179779
You'll need to upload all your sources. stdafx.h
isn't special in that regard. Of course, if your course restricts you to one .cpp upload, then you can't use stdafx.h
for that course
Upvotes: 1
Reputation: 10039
stdafx.h
is the default name of a precompiled header for a Visual Studio project. However, you can certainly have a file named this on other environments. Note that the Visual Studio compiler processes this header slightly differently than it does other headers, if it is specified as the precompiled header in your project's property pages (C/C++ -> Precompiled Headers - see here for more details). For example, multiple includes of this file with different preprocessor defines will be ignored when it is the precompiled header (which isn't that common, but something to be aware of).
If you want to make portability to non-Visual Studio environment easier, it's usually easier to disable precompiled headers in your Visual Studio project. If you continue to use the stdafx.h
file in your code, you will obviously need to upload it to your test compilation server, and may need to modify it and/or its inclusion into your code.
Upvotes: 1