PDA

View Full Version : Visual Studio Problem


GoldenEagle
04-29-2004, 04:54 PM
Hey guys -

I am having troubling compiling a program in Visual C++. I am having to do it for a class and I am getting the following error when I try to run the program. The screen flickers then kicks back to this...

Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
The thread 0x9E8 has exited with code 0 (0x0).
The program 'C:\Program Files\Microsoft Visual Studio\MyProjects\Learning\Debug\Learning.exe' has exited with code 0 (0x0)

I am doing it in a Win32 console enviorment. The complier was issued you to me under the liscense of the school. Anyone know what could be wrong?

Taco
04-29-2004, 05:22 PM
It's been awhile since I've used Visual Studio, but isn't code 0 = success? Is it possible that your program is running successfully, but since it is a console app it just runs and completes and then sends you back to the debugger? Does the program wait for any sort of user input? What happens when you run it outside of Visual Studio from the command line?

sabotai
04-29-2004, 05:23 PM
Taco sounds correct. You say it flickers. That's probably the console window opening and closing.

EDIT: Just throw a little bit of code to get input from the user somewhere in the code just to see if it is actually running.

GoldenEagle
04-29-2004, 05:30 PM
The code does not ask for user input...

How can I get it to where it stays up?

PS I hate the console.

sabotai
04-29-2004, 06:11 PM
Actually, on second thought, why not just create a text file and output lines to it. Like everytime the code does something, you output "Attempting to..." before that section of code and than "Success" after it (or say what went wrong if it didn't work).

I had to learn several times to make this a habit. Welcome to the real world of computer programming. :)

sabotai
04-29-2004, 06:15 PM
example, everytime I add a fighter to the database for my boxing dynasty, I see this in my browser

Attempting to add fighter...
Connected
DB selected
Variables copied over
slashes added and integers made
query made
INSERT INTO tblFighters VALUES (NULL, 'John', 'Ferguson', 'Sandy', 0, 0, 0, 0, 0, 0, '1898', 'np.jpg', 1898, 1916, 0.0)
query sent
1 fighters added.


Where "1 fighters added" (shut up grammer cops, this is code. :) ), if something goes wrong with the query attempt, it'll post it there.

GoldenEagle
04-29-2004, 06:41 PM
Actually, on second thought, why not just create a text file and output lines to it. Like everytime the code does something, you output "Attempting to..." before that section of code and than "Success" after it (or say what went wrong if it didn't work).

I had to learn several times to make this a habit. Welcome to the real world of computer programming. :)
How would I exaclty do this? You misspelled grammar... :)

Taco
04-29-2004, 07:34 PM
Like I said, it's been awhile since I have done Visual Studio (and C++), but I believe if you put Readln(); as the last line of your program that it will keep the console window open until you hit enter.

GoldenEagle
04-29-2004, 08:13 PM
Like I said, it's been awhile since I have done Visual Studio (and C++), but I believe if you put Readln(); as the last line of your program that it will keep the console window open until you hit enter.
That didn't work.

Here is the code:
#include <iostream.h>

int main()
{
int x = 5;
int y = 7;
cout << "\n";
cout << x + y << " " << x * y;
cout << "\n";
return 0;
}
Readln();

sabotai
04-29-2004, 08:14 PM
No, put the Readln(); before the return 0;

The return 0; line is what closes the program.

GoldenEagle
04-29-2004, 08:18 PM
No, put the Readln(); before the return 0;

The return 0; line is what closes the program.
That gives an undeclared idenitifier error.

sabotai
04-29-2004, 08:20 PM
Here's how it would be done using the text file output:


int main()
{
ostream outfile('Output.txt');

outfile << "Beginning program\n";

int x = 5;
int y = 7;

outfile << "Integers x and y declared. x set to 5, y set to 7\n";

cout << "\n";
cout << x + y << " " << x * y;
cout << "\n";

outfile << "The sum of x and y is outputed to the screen\n";
outfile << "The program closes\n";

return 0;

}


Then check the file in the directory where your program is and make sure all of the lines have been outputed. If they have, then your program ran fine.

For the Readln(); I don't know the exact use of the that line anymore...in fact, I think that's PASCAL, not C++. :)

sabotai
04-29-2004, 08:22 PM
Instead of Readln(); use getch();

Bonegavel
04-29-2004, 08:27 PM
when you run a console program (assuming VS 6) it will auto-pause waiting for a key press.

GoldenEagle
04-29-2004, 09:19 PM
when you run a console program (assuming VS 6) it will auto-pause waiting for a key press.
Nope. The code does not show up either. Just a blank screen flickers.

Taco
04-29-2004, 09:59 PM
Pascal, C++, I can't keep them all straight anymore! :) Isn't it "cin" that I was thinking of... Anyway, I should stop giving advice about this. Good luck GE!

GoldenEagle
04-29-2004, 10:09 PM
Pascal, C++, I can't keep them all straight anymore! :) Isn't it "cin" that I was thinking of... Anyway, I should stop giving advice about this. Good luck GE!
I figured it out. I was hitting F5 to excute the program instead of Ctrl F5. I have no idea what F5 does.

sabotai
04-29-2004, 10:13 PM
F5 runs the program in Debug mode, which now makes a lot more sense for what you originall posted.

Bonegavel
04-30-2004, 07:45 AM
GE,

You have an inlcude statement, but aren't including anything. Isn't there something like:

#include &lt;library.h&gt;<LIBRARY.H><LIBRARY.H>

that you must add?

[edit - ah, when you insert greater than and less than brackets in this editor the browser interprets them as html- you have to you ampersand-gt; and lt for that to show up. - what are you including?]

Bonegavel
04-30-2004, 07:50 AM
dola, oh, i see you found your solution.

GE, when you run the program in debug mode (sorry, assumed you were doing that) do you get the "press any key to continue" message?

GoldenEagle
04-30-2004, 11:50 AM
dola, oh, i see you found your solution.

GE, when you run the program in debug mode (sorry, assumed you were doing that) do you get the "press any key to continue" message?
No, I do not.

While we are on the topic of Visual C++, does anyone know how can I turn on line numbers?

gstelmack
04-30-2004, 01:04 PM
While we are on the topic of Visual C++, does anyone know how can I turn on line numbers?
What? Why? C++ doesn't have line numbers, but there is a status display in the lower-right of Visual C++ that shows the current line.

What version of Visual C++ are you using? That's going to make a difference in some of these UI questions.

Mr. Wednesday
04-30-2004, 11:56 PM
Hey guys -

I am having troubling compiling a program in Visual C++. I am having to do it for a class and I am getting the following error when I try to run the program. The screen flickers then kicks back to this...

Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
The thread 0x9E8 has exited with code 0 (0x0).
The program 'C:\Program Files\Microsoft Visual Studio\MyProjects\Learning\Debug\Learning.exe' has exited with code 0 (0x0)

I am doing it in a Win32 console enviorment. The complier was issued you to me under the liscense of the school. Anyone know what could be wrong?As I think has been addressed, there's absolutely nothing going wrong here. The program executes and completes with a value of 0, which indicates success -- either an explicit 'return 0' statement or one that's implicit by falling off the bottom of main without a return.

F5 will run the program in debug mode, whereas Ctrl-F5 will execute the program outside the debugger. You'll only notice the difference if you have errors (if it's in the debugger, by default it will break on exceptions rather than killing the program) or if you've set breakpoints.

Mr. Wednesday
04-30-2004, 11:59 PM
Dola, the way I'd handle convincing the console window to stay open is thusly:

#include &lt;ostream&gt; // pedantic, I don't think you need it in VC.
#include &lt;istream&gt; // pedantic, I don't think you need it in VC.
#include &lt;iostream&gt;

int main(void)
{
// ... whatever....
char c;
std::cout << "Press enter to continue:";
std::cin >> c;
}

Front Office Football Central Database Error
Database Error Database error
The Front Office Football Central database has encountered a problem.

Please try the following:
The forumsold.operationsports.com forum technical staff have been notified of the error, though you may contact them if the problem persists.
 
We apologise for any inconvenience.