![]() |
|
#1
|
|||
|
|||
Error LNK2005: _main already defined inhey guyz how's it going? alright the thing is i am working on structs, i think i have finished the code. when i compile it i don't have any errors but 4 warnings which i don't understand. following that when i run the program it gives me 2 errors. they are common and i searched for them on Google. i saw lot of them but didn't know where was i making error, and how should i fix it. this is what the code suppose to do
Create 2 instances of the Struct 1st Instance is underneath and 2nd is suppose to be ours. Mr. Lupoli 18005557878 1600 Pennsylvania Ave. Washington D.C. 20001 my code is CPP / C++ / C Code:
my errors are 1>------ Build started: Project: Struct, Configuration: Debug Win32 ------ 1>Linking... 1>Struct.obj : error LNK2005: _main already defined in Struct 2.obj 1>C:\Users\Amateen\Documents\Visual Studio 2005\Projects\Struct\Debug\Struct.exe : fatal error LNK1169: one or more multiply defined symbols found 1>Build log was saved at "file://c:\Users\Amateen\Documents\Visual Studio 2005\Projects\Struct\Struct\Debug\BuildLog.htm" 1>Struct - 2 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped how should i fix the problem. THANKS in Advance |
|||
|
#2
|
|||
|
|||
Re: need assisstance fixing an errorQuote:
Quote:
I mean, I wouldn't even dream of trying to run a program of mine unless I understood every stinkin' thing that the compiler tried to tell me. I would then do whatever I reasonably could to get a clean compile. (But, that's just me: I'm funny that way.) Quote:
How many source files are in your project? How many of them have a main() function? How many main() functions can a program have? Why do you need anything more than the file that you showed? Regards, Dave Footnote: Both of the numbers in your initializers for Tele can't be held in 32-bit integers (which is what most systems have these days). These lines cause my compiler to generate error messages (and no executable is created). I guess it's possible that some compilers just give warnings here (and if they do, then it's pretty much a sure thing that they won't store the value that you are trying to giv it). Maybe the Tele should be a string also??? Or, to put it another way: Is there any reason why it couldn't be a string? |
|
#3
|
|||
|
|||
Re: need assisstance fixing an errori have 2 source files. struct 1 and struct 2. my warnings are
1>c:\users\amateen\documents\visual studio 2005\projects\struct\struct\struct 2.cpp(1 1>c:\users\amateen\documents\visual studio 2005\projects\struct\struct\struct 2.cpp(1 1>c:\users\amateen\documents\visual studio 2005\projects\struct\struct\struct 2.cpp(21) : warning C4305: 'initializing' : truncation from '__int64' to 'int' 1>c:\users\amateen\documents\visual studio 2005\projects\struct\struct\struct 2.cpp(21) : warning C4309: 'initializing' : truncation of constant value tell me if you need more. |
|
#4
|
|||
|
|||
Re: need assisstance fixing an errori figured it out thanks
|
Recent GIDBlog
Not selected for officer school by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Two-Tier data dissemination code installation problem | nidhibansal1984 | Computer Software Forum - Linux | 6 | 16-Sep-2007 10:13 |
| Linked Lists advice request | promsan | C Programming Language | 74 | 23-May-2007 08:29 |
| Major newbie problem | cynack | MS Visual C++ / MFC Forum | 1 | 08-Apr-2007 11:25 |
| Winsock error when compiling FLTK 2.0 Projects | mauriciorossi | FLTK Forum | 3 | 16-Aug-2005 10:18 |
| Help with syntax errors | PeteGallo | C Programming Language | 7 | 08-Aug-2005 20:30 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The