0

I have a project that compiling with GCC, and now I want open and run it with visual studio.what should I do?

I created new C project in visual studio and then add .c files to Source Files and add .h files to Header Files,too. But what should I do for makefile?

I see these error:

Error   9   error LNK2005: _main already defined in basic00.obj fp.obj

Error   10  error LNK2001: unresolved external symbol _optind   fp.obj

Error   11  error LNK2001: unresolved external symbol _optopt   fp.obj

Error   12  error LNK2001: unresolved external symbol _optarg   fp.obj

Error   13  error LNK2019: unresolved external symbol _getopt referenced in function _main  fp.obj

Error   14  error LNK2001: unresolved external symbol _opterr   fp.obj

Error   15  fatal error LNK1120: 5 unresolved externals C:\Users\user\Documents\Visual Studio 2008\Projects\project.c\Debug\project.c.exe
1

1 Answer 1

0
  1. You need to remove the second main() function.
  2. You're using optind, optopt etc. These functions are defined in POSIX library, VS compiler doesn't have these ones. You need to remove these calls.
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.