Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

simple C++ main but get Access Violation?

Posted on 2005-03-29
11
Medium Priority
?
804 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
  • 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
Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses

564 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