Thread: I don't understand this error...

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    195

    I don't understand this error...

    Okay I'm just writing a short piece of code to figure out a math problem

    Code:
    #include <iostream.h>
    
    void main() {
    	int num;
    	int num2;
    	int sum=0;
    
    	cout<<"Enter num: ";
    	cin>>num;
    	
    	num2=num*2;
    
    	for (int i=1; i<num2; i++) {
    		if (num2%i==0 && num%i!=0) {
    			sum+=i;
    		}
    	}
    
    	cout<<sum<<endl;
    }
    It compiles fine but it gives me the runtime error up to the part that inputs the data then crashes. Similary if i just put 1 statement in the main like "cout<<"blah"<<endl; then it still crashes:

    Code:
    Loaded 'ntdll.dll', no matching symbolic information found.
    Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
    The thread 0x7C4 has exited with code 4373080 (0x42BA58).
    The program 'D:\C++\MathTesting\Debug\test.exe' has exited with code 4373080 (0x42BA58).
    Last edited by KneeGrow; 11-15-2004 at 11:58 PM.

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    Try without the .h in your header, perhaps?

  3. #3
    First, you should use INT MAIN and not VOID MAIN. Do a search on the board and something should come up why.
    Your MAIN function should also return 0 in the end.

    I'm not sure where the problem is... are you making a Win32 application or Win32 Console Application?

  4. #4
    Registered User
    Join Date
    May 2003
    Posts
    195
    Console application, void main and int main doesnt really matter for me since its just a test program i just wanna write the quickest and most condensed code so that i can actually do the math problem

    Anyhow, i just installed VC++6 today cuz i formatted my HD but I don't think i ve had this error before.

  5. #5
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    the dead tree has a point. It would be best to change that "void" to an "int" before Prelude shows up...or you're in deep trouble...

    [EDIT]
    And for the well-being of everyone, make sure to return something. Preferably 0.
    [/EDIT]

    [EDIT]
    Have I forgotten how to use Edit tags?? Or perhaps there are none and I'm just confused?...
    [/EDIT]
    Last edited by Epo; 11-16-2004 at 12:17 AM.

  6. #6
    Registered User
    Join Date
    May 2003
    Posts
    195
    I mean, i know some people are diehard int main fans but as for this testing program I doubt it will affect the outcome. in fact, i ve used void main for almost all my programs, same thing. and please, if you want to argue with me about int main void main plz just im me. i still dont understand this error here

  7. #7
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    I'm not too familiar with the topic of C++ specific headers, but I still think that my first suggestion was on the right track.

    http://forums.devshed.com/t111869/s.html makes me feel better about my guess. It may just by a stylistic issue, but why use out of date headers?


    [YOU-WOULDN'T-KNOW-THIS-WAS-AN-EDIT-IF-I-DIDN'T-TELL-YOU]
    Well (referring to the post below because it would've been a waste to make a new post for this), that's a tricky situation then.
    [/YOU-WOULDN'T-KNOW-THIS-WAS-AN-EDIT-IF-I-DIDN'T-TELL-YOU]
    Last edited by Epo; 11-16-2004 at 12:51 AM.

  8. #8
    Registered User
    Join Date
    May 2003
    Posts
    195
    Well when i took comp sci we always used C headers so it just stuck as a habit. Btw i already tried #include <iostream> using namespace std, still same error

  9. #9
    Registered User
    Join Date
    May 2003
    Posts
    195
    Basically, for this program, all the code is able to execute by the window never stays for the line that says "Press any key to continue..." and it just closes due to some mysterious error... help

  10. #10
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    Just thought I may mention that the code compiles fine for me. And after entering 5, it displayed 2, then asked me to "Press Any Key to Continue" before exiting.

    On a random guess, check your task manager to make sure the "exe" isn't still running.

  11. #11
    Banned
    Join Date
    Oct 2004
    Posts
    250
    this code compiles allright on VC++ 6.0 and DEV C++
    try reinstalling your compiler

  12. #12
    Registered User
    Join Date
    May 2003
    Posts
    195
    Maybe I should reinstall Visual C++ 6? I dont feel like trying other compilers cuz i've stuck with microsoft c++ forever

  13. #13
    Banned
    Join Date
    Oct 2004
    Posts
    250
    download the free compiler DEV C++ and see if it compiles

  14. #14
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > then it still crashes:
    What crash? It's working perfectly

    > Loaded 'ntdll.dll', no matching symbolic information found.
    > Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
    This is just information telling you that if you ever have to debug down into the operating system that you're in for a rough time (no symbols you see). Other than that, these two messages can be ignored.
    You can get rid of them by rummaging around on the Microsoft site somewhere (or your MSDN disks perhaps) for the latest symbol files for your OS.

    > The thread 0x7C4 has exited with code 4373080 (0x42BA58).
    Well that's the sort of garbage you get when you say void main.
    Now do the job properly and finish with a return 0;
    then the exit status will always be a nice successful 0

    > void main and int main doesnt really matter for me since its just a test program
    That kind of attitude will get you a long way - well just as far as the next "it doesn't matter to me" when in fact it "does matter to you".
    Either you learn to do the job right each time out of habit, or you end up being roadkill on the information superhighway.

  15. #15
    Registered User
    Join Date
    May 2003
    Posts
    195
    Quote Originally Posted by Salem
    > then it still crashes:
    What crash? It's working perfectly

    > Loaded 'ntdll.dll', no matching symbolic information found.
    > Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
    This is just information telling you that if you ever have to debug down into the operating system that you're in for a rough time (no symbols you see). Other than that, these two messages can be ignored.
    You can get rid of them by rummaging around on the Microsoft site somewhere (or your MSDN disks perhaps) for the latest symbol files for your OS.

    > The thread 0x7C4 has exited with code 4373080 (0x42BA58).
    Well that's the sort of garbage you get when you say void main.
    Now do the job properly and finish with a return 0;
    then the exit status will always be a nice successful 0

    > void main and int main doesnt really matter for me since its just a test program
    That kind of attitude will get you a long way - well just as far as the next "it doesn't matter to me" when in fact it "does matter to you".
    Either you learn to do the job right each time out of habit, or you end up being roadkill on the information superhighway.
    Thanks for the help but what i don't understand is why I never received these error messages before...? I've used void main a lot and I never get that exit garbage. In addition, I have never heard of this "no symbols" business; what does it mean? Is it because I reinstalled Windows with SP2? Is there any way to get rid of them? I see that the program runs fine but normally before, my programs, after execution, say "Press any key to continue" but now just closes on its own and produces those exit codes unless i stick it a getch() or pause thing. Odd
    Last edited by KneeGrow; 11-16-2004 at 04:49 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  3. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM