• Advertisement

Archived

This topic is now archived and is closed to further replies.

wtf???

This topic is 5939 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im using CodeWarrior Learning Edditon.My project has two files that have no flaws(made sure).When i got to run my project i get a link error about something wrong with main in both files.Whats wrong here?

Share this post


Link to post
Share on other sites
Advertisement
please list the exact error message, and you''ll probably get a more appropriate response.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites
did u check to make suere that u have the proper header fies included? u sould also make suer u have the proper .lib files included

,Matt

-= kill one, your a murderer, kill thousands your a conquerer =-

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
#include <iostream> is a header file right?
and i dont know what .lib files are.
here are the errors:
Link Error : multiply-defined ''main'' (descriptor)
Defined in bkla.cpp
Defined in HelloWorld.cp

Link Error : multiply-defined ''main'' (code)
Defined in bkla.cpp
Defined in HelloWorld.cp

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Have you got more than one WinMain or main() function? If so, that''s your problem right there.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
Have you got more than one WinMain or main() function? If so, that''s your problem right there.

wait,i only need one main out of my two files?

Share this post


Link to post
Share on other sites
Only one main, always remember that.

By the way, anything that is a .h is a header file. Header files basically are used to include the .lib in your program, but you have to add the .lib to your project. If your not using an API like Windows or DX/OpenGL, you don't have to worry about .libs yet.

You only need one main in your whole project, because you are including the other files which are connected to the file that has main in it.
------------------------------
Simple DirectMedia Layer:

Main Site - (www.libsdl.org)
Cone3D Tutorials- (cone3D.gamedev.net)
GameDev.net's Tutorials - (Here)

OpenGL:

Main Site - (www.opengl.org)
NeHe Tutorials - (nehe.gamedev.net)
Online Books - (Red Book) (Blue Book)


Edited by - Drizzt DoUrden on January 12, 2002 12:39:20 PM

Share this post


Link to post
Share on other sites
quote:
Original post by Drizzt DoUrden
Only one main, always remember that.
------------------------------------------------------
I know one main per a file, but do you mean one main out of all my files in my project??


Share this post


Link to post
Share on other sites
definitely one "main" per project. the linker looks for a function named "main" and sets the program to start here. thus if there were two "main"''s then it wouldn''t know which one to choose.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites

  • Advertisement