Sign in to follow this  

Saving

This topic is 4032 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

Okay I'm using dec c++ and then I'm reading tutorials that are for extreme begginers (newbs) and then i put this in one of the source files. 1: #include <iostream.h> 2: 3: int main() 4: { 5: cout << "Hello World!" << endl; 6: return 0; 7: } Then i click exit (X) and i save that source file as hello.cpp... A little later it comes up with a random error saying "Access violation at address 00403CCA in module 'DevCpp.exe'. Read of address 00001943" P.S: If you say remove the numbers that still doesn't fix the problem. Help?

Share this post


Link to post
Share on other sites
Well, Theres not much anyone can do with that kindof info, there is that technical info... but its really technical. Although, when I used dev-cpp I got that type of message somewhat often, compared to other apps; one of the reasons I switched to VC++ Express

Share this post


Link to post
Share on other sites
Okay... I'll just not use that type of application then...

What's a good type of compiler you can make decent games with?

Even though I probally won't make games in a week, I just want to be prepared :)

Share this post


Link to post
Share on other sites
OS = operating system. That's windows :)

Stick with DevC++ if you like it. Really.
One thing i don't like about devc++ is that i can't group and collapse functions (visually) but then again, i can jump between them, so it's about the same effect.

I've got v. 4.9.9.0 on windows, and except some weird errors (sometimes) when i modify what libraries it should link to, it's not such a bad compiler and IDE.

Now, to your problem.
Do you know how to compile the code?
What you write should be transformed into an exe. In devc++, do that by pressing F9. it will also run that app for you, in a console window.

But it will end immediatley, so i suggest two variants.
The first is to actually run it from the console. Go with cd and cd .. to the folder where it compiled (the same where you saved the project, ussually), and type it's name. You'll see the result! :)

Another (but ussualy bad) method is to add
system("pause");


before line 6 (return 0;) which will call another program and put your program in a "sleeping" state, waiting for you to hit a key.

other compilers i know of and tested are microsoft's visual c++ and codeblocks.

Share this post


Link to post
Share on other sites
try just typing that into notepad and saving it that way ... (and pick ASCI as the type of encoding)

then open it in DevC++ and see if it still crashes.

Sounds like you simply have a bad install of dev-c++. Try uninstalling it ... then reboot your computer, then download again and reinstall.

Share this post


Link to post
Share on other sites
Although this won't fix the problem at hand, I am compelled to note that your tutorial is *many* years out of date, and you should discard it. Proper code is as follows (among other similar options):


#include <iostream>

int main() {
std::cout << "Hello World!" << std::endl;
}


Also, read the forum Forum FAQ and see how to format code properly for posting.

Share this post


Link to post
Share on other sites
I think the problem in your code is your using "cout" and "endl" w/o the "std::" prefix.

One way around having to write that a lot is to put this in your code:


using namespace std;



Note, however, that this method is only recommended for larger apps, because it takes up a few to many resources for something as simple as "Hello, world".

Share this post


Link to post
Share on other sites
Quote:
Original post by RavynousHunter
I think the problem in your code is your using "cout" and "endl" w/o the "std::" prefix.

One way around having to write that a lot is to put this in your code:

*** Source Snippet Removed ***

Note, however, that this method is only recommended for larger apps, because it takes up a few to many resources for something as simple as "Hello, world".


Say what?

If anything, a using declaration like that is ONLY recommended for very small projects. A using declaration doesn't use any resources of any kind whatsoever. It is a compile-time only thing.

The larger the project, the greater the chance of a name-clash, so the less you should be using global using declarations like that.

Also, while ommitting the std:: from cout etc may have prevented the OP's application from compiling, it is not very likely to have been the cause of a run-time crash.

Share this post


Link to post
Share on other sites
Quote:
Original post by EasilyConfused
Quote:
Original post by RavynousHunter
I think the problem in your code is your using "cout" and "endl" w/o the "std::" prefix.

One way around having to write that a lot is to put this in your code:

*** Source Snippet Removed ***

Note, however, that this method is only recommended for larger apps, because it takes up a few to many resources for something as simple as "Hello, world".


Say what?

If anything, a using declaration like that is ONLY recommended for very small projects. A using declaration doesn't use any resources of any kind whatsoever. It is a compile-time only thing.

The larger the project, the greater the chance of a name-clash, so the less you should be using global using declarations like that.

Also, while ommitting the std:: from cout etc may have prevented the OP's application from compiling, it is not very likely to have been the cause of a run-time crash.


Of course, its is entierly possible that I got it backwards, I tend to do that sometimes.

Personally, I don't see a thing wrong with his program at all.

Share this post


Link to post
Share on other sites
Quote:
Original post by pissoffboi
Okay it doesn't show that specific error anymore but now anytime i click anything (like exit compile, debug, new _____ etc.) it says Out of Memory....

More help please :)


hmm how much ram do you have ?
how much free space do you have on your C drive ?

(could it be as simple as your computer running out of both physical and virtual memory ?)

Share this post


Link to post
Share on other sites
I got the exact same error when I used Dev-CPP. I could never solve it. I now use Visual C++, and I love it! Visual C++ is a professional IDE also.


That is just what I suggest.


Chad.

Share this post


Link to post
Share on other sites

This topic is 4032 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this