Skip to main content
gamedev.net
🔒 Locked

C: error LNK2001

Started by Spade_K 6 replies 750+ views
Original Post
Spade_K
Spade_K
I have converted my model file, written in Simulink, to C code using Real-Time Workshop, a product of TheMathWorks. I opened up the name.c folder, then attempted to build it in VC++. I incompletely debugged the program, since these two errors remain whenI attempt to built it, " Linking... circ1_real.obj : error LNK2001: unresolved external symbol _rtP LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main Debug/circ1_real.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. circ1_real.exe - 3 error(s), 0 warning(s). " I googled these errors. One proposed solution is to make sure that this VC++ Project is compiled as a Win32 Application, not a Console. Please provide help with these bugs. I thank you.
ToohrVyk
ToohrVyk
Obvious question: does your program have an entry point. If so, what is it, where is it, and is it compiled?
Spade_K
Spade_K
Quote:
Original post by ToohrVyk
Obvious question: does your program have an entry point. If so, what is it, where is it, and is it compiled?


I added,

--int main() {
--
--...
--return 0;
--}

however the number of problems only multiplied.
Spade_K
Spade_K
Quote:
Original post by ToohrVyk
What errors do you have now?


These errors occur after adding "

-- int main () {
-- ...
-- return 0;
-- }

Errors:

Compiling...
circ1_real.c
c:\program files\microsoft visual studio\vc98\include\winnt.h(529) : error C2143: syntax error : missing ';' before '{'
c:\program files\microsoft visual studio\vc98\include\winnt.h(540) : error C2143: syntax error : missing ';' before 'type'
c:\program files\microsoft visual studio\vc98\include\winnt.h(637) : error C2143: syntax error : missing ';' before 'type'
c:\program files\microsoft visual studio\vc98\include\winnt.h(643) : error C2143: syntax error : missing ';' before '<class-head>'
c:\program files\microsoft visual studio\vc98\include\winnt.h(645) : error C2143: syntax error : missing ';' before 'type'

More than 100 errors occur during compilation.

Thanks.
ToohrVyk
ToohrVyk
Could you post the relevant portions of your file here? (#includes, and the code around main).
Spade_K
Spade_K
Quote:
Original post by ToohrVyk
Could you post the relevant portions of your file here? (#includes, and the code around main).


Before you address my code, I request some help in figuring out the correct location of the entry point.

How can I find a suitable entry point position? My friend, a mid-level programmer, said that an entry cannot be blindly placed above the #includes.

Thanks.
Zahlman
Zahlman
Quote:
Original post by Spade_K
Quote:
Original post by ToohrVyk
Could you post the relevant portions of your file here? (#includes, and the code around main).


Before you address my code, I request some help in figuring out the correct location of the entry point.


Er, that's why he wants to see the code. :)

BTW, consider posting in For Beginners; it sounds like you really have no idea about what is going on.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.