Problem debugging hello world

Discuss about Programming here. You may release your source, post guide and even ask questions!

Moderator: wizme

Post Reply
ShiunYean
Headmaster of Darkness
Headmaster of Darkness
Posts: 648
Joined: Tue Sep 08, 2009 2:59 pm
Location: Brunei Darussalam
Contact:

Problem debugging hello world

Post by ShiunYean »

When I tried to debug this code:

Code: Select all

#include <iostream>
using namespace std;
 
int main()
{
            cout << “Hello World!” << endl;
            return 0;
}
I get this:

Code: Select all

1>------ Build started: Project: testing, Configuration: Debug Win32 ------
1>  hello.cpp
1>c:\users\user\documents\visual studio 2010\projects\hello world\testing\hello.cpp(6): error C2065: '“Hello' : undeclared identifier
1>c:\users\user\documents\visual studio 2010\projects\hello world\testing\hello.cpp(6): error C2146: syntax error : missing ';' before identifier 'World'
1>c:\users\user\documents\visual studio 2010\projects\hello world\testing\hello.cpp(6): error C2065: 'World' : undeclared identifier
1>c:\users\user\documents\visual studio 2010\projects\hello world\testing\hello.cpp(6): error C2143: syntax error : missing ';' before '!'
1>c:\users\user\documents\visual studio 2010\projects\hello world\testing\hello.cpp(6): error C2065: '”' : undeclared identifier
1>c:\users\user\documents\visual studio 2010\projects\hello world\testing\hello.cpp(6): error C2563: mismatch in formal parameter list
1>c:\users\user\documents\visual studio 2010\projects\hello world\testing\hello.cpp(6): error C2568: '<<' : unable to resolve function overload
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(1021): could be 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)'
1>          with
1>          [
1>              _Elem=unsigned short,
1>              _Traits=std::char_traits<unsigned short>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(1011): or       'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)'
1>          with
1>          [
1>              _Elem=wchar_t,
1>              _Traits=std::char_traits<wchar_t>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(1003): or       'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ostream(977): or       'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Can anyone help? I'm using Microsoft Visual Express C++ 2010.
happy125
Headmaster of Darkness
Headmaster of Darkness
Posts: 549
Joined: Tue Jun 22, 2010 10:06 pm
Location: Singapore

Re: Problem debugging hello world

Post by happy125 »

nothing wrong with ur script. u run using f5 or ctrl f5. if u use ctrl f5 shuld be no prob
If ur good at smth, never do it for free.
Maple ID list v1.02
Image
Image
Image
ShiunYean
Headmaster of Darkness
Headmaster of Darkness
Posts: 648
Joined: Tue Sep 08, 2009 2:59 pm
Location: Brunei Darussalam
Contact:

Re: Problem debugging hello world

Post by ShiunYean »

happy125 wrote:nothing wrong with ur script. u run using f5 or ctrl f5. if u use ctrl f5 shuld be no prob
I tried pressing ctrl f5, still get the same error.

Edit:
I think I sort of fixed it, I tried a different code, this time i right click and choose compile and it worked, then I paste it to a folder, and used a command line to compile it.
User avatar
Nerrazzuri
Destiny General
Destiny General
Posts: 1110
Joined: Sun Dec 20, 2009 9:15 pm

Re: Problem debugging hello world

Post by Nerrazzuri »

Code: Select all

#include <Windows.h>
Selling my ultimate trainer for MapleStory SEA --> View below for screenshot

Click Here for more Information!

Image
wenwen123
Sacrificer
Sacrificer
Posts: 25
Joined: Wed Apr 28, 2010 10:11 pm

Re: Problem debugging hello world

Post by wenwen123 »

er..i faced same prob wif him..bt i get this:

'rox.exe': Loaded 'C:\Users\user\Documents\Visual Studio 2010\Projects\rox\Debug\rox.exe', Symbols loaded.
'rox.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'rox.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'rox.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'rox.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'rox.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
The program '[4372] rox.exe: Native' has exited with code 0 (0x0).
User avatar
Nerrazzuri
Destiny General
Destiny General
Posts: 1110
Joined: Sun Dec 20, 2009 9:15 pm

Re: Problem debugging hello world

Post by Nerrazzuri »

wenwen123 wrote:er..i faced same prob wif him..bt i get this:

'rox.exe': Loaded 'C:\Users\user\Documents\Visual Studio 2010\Projects\rox\Debug\rox.exe', Symbols loaded.
'rox.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'rox.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'rox.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'rox.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'rox.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
The program '[4372] rox.exe: Native' has exited with code 0 (0x0).
There is nothing wrong with your codes, you're running the program fine with the PDB source, thats all. I believe you're getting the cmd to load and close too fast issue.

try adding

Code: Select all

system("PAUSE");
before the return 0; syntax.
Selling my ultimate trainer for MapleStory SEA --> View below for screenshot

Click Here for more Information!

Image
happy125
Headmaster of Darkness
Headmaster of Darkness
Posts: 549
Joined: Tue Jun 22, 2010 10:06 pm
Location: Singapore

Re: Problem debugging hello world

Post by happy125 »

Nerrazzuri wrote:
wenwen123 wrote:er..i faced same prob wif him..bt i get this:

'rox.exe': Loaded 'C:\Users\user\Documents\Visual Studio 2010\Projects\rox\Debug\rox.exe', Symbols loaded.
'rox.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'rox.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'rox.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'rox.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'rox.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
The program '[4372] rox.exe: Native' has exited with code 0 (0x0).
There is nothing wrong with your codes, you're running the program fine with the PDB source, thats all. I believe you're getting the cmd to load and close too fast issue.

try adding

Code: Select all

system("PAUSE");
before the return 0; syntax.
and also

Code: Select all

#include cstdlib 
infront.
If ur good at smth, never do it for free.
Maple ID list v1.02
Image
Image
Image
wenwen123
Sacrificer
Sacrificer
Posts: 25
Joined: Wed Apr 28, 2010 10:11 pm

Re: Problem debugging hello world

Post by wenwen123 »

thx all..which book is suitable for newbie??
Post Reply