Reputation: 502
I am trying to set up a project in visual studios for C but every time i do, i first get this error message
fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
then when i fix it by going into the "Properties->Precompiled header" i get this message
error LNK2005: _main already defined in clang.obj
. This has been going on for days now and i watched a bunch of videos and read a bunch of articles on this and I can't seem to find a fix. I just want to run my C program and have it execute without dealing with errors like those above. Here is what i do to set it up,
Upvotes: 0
Views: 122
Reputation: 11047
I think the problem is that when you choose Windows console application
template, VS 2017 already generated a file which has a int main()
function defined in it.
Then you added another file name.c
which also has a main()
function. Thus you got that error.
Upvotes: 1