LightbulbNeed some help here

Posts 1–8 of 8 · Page 1 of 1
Need some help here
Hi all,
I started with coding some really easy things recently , but i canut get anything to work , My first code for example :

// operating with variables

#include <iostream>
using namespace std;

int main ()
{
// declaring variables
int a, b;
int result;

// process:
a = 5;
b = 2;
a = a + 1;
result = a - b;

// print out the result
cout << result;

// terminate the program
return 0;
}

For a really easy calculator , now , i opened this as a project file or however u call it , and then i get this error as an .exe :

'Calculator.exe': Loaded 'C:\Users\Hoofdaccount\Documents\Visual Studio 2010\Projects\Calculator\Debug\Calculator.exe', Symbols loaded.
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\mscoree.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\msc oreei.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr .dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\msvcr100_clr0400.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\ms corlib\dc0b188b244ec4a4ccec59ac6f1620ad\mscorlib.n i.dll', Cannot find or open the PDB file
'Calculator.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib \v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
'Calculator.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\nls sorting.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'Calculator.exe' (Managed (v4.0.30319)): Loaded 'c:\users\hoofdaccount\documents\visual studio 2010\Projects\Calculator\Debug\Calculator.exe', Symbols loaded.
'Calculator.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr jit.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\dia symreader.dll', Cannot find or open the PDB file
'Calculator.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\Sy stem\4532468deac0fdeff26329333c7642b6\System.ni.dl l', Cannot find or open the PDB file
'Calculator.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System \v4.0_4.0.0.0__b77a5c561934e089\System.dll'
The thread 'Win32 Thread' (0x129c) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xa80) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xaac) has exited with code 0 (0x0).
The program '[1292] Calculator.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
The program '[1292] Calculator.exe: Native' has exited with code 0 (0x0).

And this error as a .dll :

''Unable to start program 'C/.............../Projects/Calculator/Debug/Calculator.dll''

Now , how to solve this ? I cant get anything to work ... pls help
You created a console project? If yes, the console window just disappears too fast so you cant see it. You could add a getch(); at the end, it would make the program wait for a keypress. Include conio.h to use it.
Quote Originally Posted by Nico View Post
You created a console project? If yes, the console window just disappears too fast so you cant see it. You could add a getch(); at the end, it would make the program wait for a keypress. Include conio.h to use it.
well ye, its a console project , and there opens an (empty) black window wich dissapears the same second , well , how to do that thingy to make it last longer ? cus im a newb
Use

std::cin.get();

at the end of your code to wait for the user to press a key before continuing (i.e, terminating). Put it before the "return 0;" line though, otherwise the function will exit before it gets to the std::cin.get();
Quote Originally Posted by Jason View Post
Use

std::cin.get();

at the end of your code to wait for the user to press a key before continuing (i.e, terminating). Put it before the "return 0;" line though, otherwise the function will exit before it gets to the std::cin.get();
This. Or use Sleep(millisecs) if you want the window to disappear after a specified amount of time.
i added Sleep(time) etc , but still , the black window opens , and dissapears after saying Hello World --' i dont get it lols

Wait , i prolly found ma mistake , when u start new project , console application , etc , then u get a series of files wich are already coded , do u need to make a new file (wich) ? or put this code in wich file (basic starting name) ?

wow , when i run it now (made some lil adjustements) the answer appears in the black box but dissapears again fast , and when i add Sleep(time) or any of the other things before return 0; then i get an error ...

Ok , it works !!!! The code is now :

// Calculator3.cpp : main project file.

#include "stdafx.h"
#include <iostream>
using namespace std;

int main ()
{
// declaring variables
int a, b;
int result;

// process:
a = 5;
b = 2;
result = a + b;

// print out the result
cout << result;

// time
std::cin.get();

// terminate program
return 0;
}

It works , ty so much
put the cin.get(); right before the return 0; if your having to enter any data you need to use cin.get(); more than once.
Quote Originally Posted by Tulleye View Post
put the cin.get(); right before the return 0; if your having to enter any data you need to use cin.get(); more than once.
Perhaps you should read the code he already has before posting, then you'd see he already solved it and cin.get() was already before "return 0" (which I outlined in my first post anyway...)
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us