?
Solved

simple C++ main but get Access Violation?

Posted on 2005-03-29
11
Medium Priority
?
803 Views
Last Modified: 2010-04-24
#include <iostream.h>

int main() {
      
                cout << "hello Joyce" << endl;      
      return 0;

}


when i run and step into it, i got this..... what should i do?

Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
First-chance exception in assign1.exe: 0xC0000005: Access Violation.
First-chance exception in assign1.exe: 0xC0000005: Access Violation.


0
Comment
Question by:StanleyLMW
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 13653371
which compiler ?

also try to use
#include <iostream>

but I think problem is more related to some compiler options.
0
 

Author Comment

by:StanleyLMW
ID: 13653452
I am using MS Visual C++ 6.0

now i removed the ".h". It then cannot reconize cout, so i add namespace. I got access violation error.
When i step into it, it asked me for path of strlen.asm......

#include <iostream>
using namespace std;

int main() {
      
      cout << "hello Joyce" << endl;      
      return 0;

}
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 13653504
It appear to be that you are not linking STL library correctly.
You have not responded which compiler are you using.
0
Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

 

Author Comment

by:StanleyLMW
ID: 13653522

I did respond... MS Visual C++ 6.0.
0
 

Author Comment

by:StanleyLMW
ID: 13653569

 i am waiting ... James...
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 2000 total points
ID: 13653589
Oh, sorry, how do you have created your project?

I have created a test project in VC++6 this way:

File -> New -> Projects -> Win32 Console application -> Empty project

Then I added a cpp file with the following contents:

#include <iostream>
using namespace std;

int main(int argc, char* argv[])
{
     cout << "hello Joyce" << endl;    
     return 0;
}

I have compiled and works ok.
0
 

Author Comment

by:StanleyLMW
ID: 13653678

IT WORKS!!!! Thanks alot!!!! You earn another 500 points.
I also created in that win32 console. i tried copy the arguments in my main... i still got run time error. not sure why.
Can you please also answer my 2nd questions?
0
 

Author Comment

by:StanleyLMW
ID: 13653699
please also answer my open question linklist.cpp. thanks!
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 13653701
> i tried copy the arguments in my main... i still got run time error. not sure why.
> Can you please also answer my 2nd questions?

I am not sure about what are you asking, could you be more specific?, if an error message, please post it.
0
 

Author Comment

by:StanleyLMW
ID: 13653758

i already post it as my open questions.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 13653789
OK, I have post an answer, hope to be useful.
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question