• Advertisement
Sign in to follow this  

Problem runing program from book

This topic is 3874 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've read some of "Beginning Game programing" a while ago but i stop for a while, recently i started reading it again and on the second chapter i can not get the programs to Run in MSVC 2005 Express Edition(in the book it say every thing should work fine with that compiler, and it did the first time a read the book) But now when i try to run programs form the book that i have type or off the CD (i have tried more then one program) the program dose not run, when i go to debug it says this project is out of date and shows the project in the box below, when i click Build is says that there were build errors, would like to continue and i click yes, then it say it cannot find the path specified. The first time i read the book I'm not sure what i used as a template when i started a new project because in the book it say to use Win32 project but that is not in MSVC 2005 its from 2003( i think) i can't remember what i put instead of it the first time i read the book and i've tried a lot of different one's My questions are what I'm i doing wrong and what should i do different to get the programs to run, and what should i use as a template in Visual Studio C++ 2005 for a windows application The only difference for now and then is I'm using a new computer, and installed MSVC recently and maybe there been some changes in it or something Please Help, i want to start programming again

Share this post


Link to post
Share on other sites
Advertisement
I know that Win32 applications are disabled in VC2005 express edition, I think there is a way to change this but I'm not sure what it is.

When the program tells you there are build errors, this means it did not compile/link your code because there is an error somewhere. The reason click "Yes to continue" isn't working is because there is no executable being created, due to the errors.

VC2005 Express confused me when I started using it because there are some interface changes, but it would be helpful to see both the code you are trying to compile as well as the errors you are receiving. Your build errors should be in the bottom box of VC. If you look there should be a few tabs, Code Definition Window, Call Browser, Output, and Error List depending on the windows you have enabled. If you don't see Error List on one of these tabs, simply go to View->OtherWindows and select Error List. Once its enabled it will show up in the bottom box as one of the tabs.

Seeing your code and knowing the errors you are receiving will allow someone to help you with your problem.

*EDIT* When I was using express I would just start with an empty project, and copy the WIN32 code I had used in other projects, its a bit tedious, but it will get the job done.

Share this post


Link to post
Share on other sites
Yes. My book of "Beginning Game Programming" (ISBN I-59200-585-3) is expressly written for VC2003. Although I haven't picked up this book in a year, I still use VC2003 exclusively because most of my manuals still use that for examples.

When I have tried to use VC2005 (VC++ Version 6.0, is it?) on existing projects, I have come up with numerous errors. Building projects exclusively from VC2005 seems the way to go.

If you have your VC2003 compiler around, use that to reintroduce yourself to the basics while you learn the differences between the compilers. As a side note, I was talking with some guys from a dev house here, and they still use VC2003. Not sure if that's worth anything, but good luck!


** edit **
To the above P.S.: Always start your projects as empty.

Share this post


Link to post
Share on other sites
Yes I went back to 2003 after using the 2005EE. BTW I believe VC2005 is version 8.0. Good to know about the empty projects though, I often create my projects empty because I do not like the pre-written code from VS.

Share this post


Link to post
Share on other sites
Quote:
Original post by argonaut
Yes. My book of "Beginning Game Programming" (ISBN I-59200-585-3) is expressly written for VC2003. Although I haven't picked up this book in a year, I still use VC2003 exclusively because most of my manuals still use that for examples.

When I have tried to use VC2005 (VC++ Version 6.0, is it?) on existing projects, I have come up with numerous errors. Building projects exclusively from VC2005 seems the way to go.

If you have your VC2003 compiler around, use that to reintroduce yourself to the basics while you learn the differences between the compilers. As a side note, I was talking with some guys from a dev house here, and they still use VC2003. Not sure if that's worth anything, but good luck!


** edit **
To the above P.S.: Always start your projects as empty.


Where do i get VC2003, it's not on the book CD

Share this post


Link to post
Share on other sites
Quote:
Original post by TheN00B
I know that Win32 applications are disabled in VC2005 express edition, I think there is a way to change this but I'm not sure what it is.

When the program tells you there are build errors, this means it did not compile/link your code because there is an error somewhere. The reason click "Yes to continue" isn't working is because there is no executable being created, due to the errors.

VC2005 Express confused me when I started using it because there are some interface changes, but it would be helpful to see both the code you are trying to compile as well as the errors you are receiving. Your build errors should be in the bottom box of VC. If you look there should be a few tabs, Code Definition Window, Call Browser, Output, and Error List depending on the windows you have enabled. If you don't see Error List on one of these tabs, simply go to View->OtherWindows and select Error List. Once its enabled it will show up in the bottom box as one of the tabs.

Seeing your code and knowing the errors you are receiving will allow someone to help you with your problem.

*EDIT* When I was using express I would just start with an empty project, and copy the WIN32 code I had used in other projects, its a bit tedious, but it will get the job done.


// Beginning Game Programming
// Chapter 2
// HelloWorld program

//#define WIN32_LEAN_AND_MEAN

#include <windows.h>
//#include <windowsx.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nShowCmd)
{
MessageBox(NULL, "Motoko Kusanagi has hacked your system!",
"Public Security Section 9", MB_OK | MB_ICONEXCLAMATION);

return 0;

}




1>------ Build started: Project: 787, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>e:\sources\chapter02\HelloWorld\main.cpp(7) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
1>Build log was saved at "file://c:\Documents and Settings\Chris\My Documents\Visual Studio 2005\Projects\787\787\Debug\BuildLog.htm"
1>787 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Share this post


Link to post
Share on other sites
I didn't see this mentioned anywhere, so here goes: Platform SDK. You can't make win32 programs in Visual C++ Express Edition without it. Read the directions thoroughly as it's easy to mess up.

Also, I think that you've been getting the versions messed up.

has released really only 5 (the 6th is coming out in a year or so and is in public beta for the express editios) major IDEs since 1997. Visual Studio in '97, Visual Studio 6.0 in 1998, Visual Studio.NET in 2002 aka 7.0, Visual Studio.NET 2003 aka 7.1, Visual Studio 2005 (no .NET in name any more) aka 8.0, and eventually Visual Studio 2008 code-named Orcas. This information and more can be had from Wikipedia.

Share this post


Link to post
Share on other sites
Quote:
Original post by nobodynews
I didn't see this mentioned anywhere, so here goes: Platform SDK. You can't make win32 programs in Visual C++ Express Edition without it. Read the directions thoroughly as it's easy to mess up.


how do i do that


Share this post


Link to post
Share on other sites
Here is the link. I had to do this too.

http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/

I also notice that some of the older DirectX will not compile correctly with some new versions of the platform SDK.

Share this post


Link to post
Share on other sites
i had trouble with step 4, i found the file but i don't know how to change the string(i don't even know what a string is)

Share this post


Link to post
Share on other sites
Go to the file corewin_express.vsprops in the folder it shows and open it with notepad. Inside with be a lot of text which I guess are reffered to as strings here. Find the text they show you and edit as they show you.

Do the same thing in step five. Use the edit/goto command to get to the line they tell you to and edit it with notepad.

Share this post


Link to post
Share on other sites
Quote:
Original post by Chris27
Go to the file corewin_express.vsprops in the folder it shows and open it with notepad. Inside with be a lot of text which I guess are reffered to as strings here. Find the text they show you and edit as they show you.

Do the same thing in step five. Use the edit/goto command to get to the line they tell you to and edit it with notepad.


i did that and was able to make a win32 project but when a copy the source code from the CD i still get errors

1>------ Build started: Project: 0, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>e:\sources\chapter02\helloworld\main.cpp(7) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
1>Build log was saved at "file://c:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin\0\0\Debug\BuildLog.htm"
1>0 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Share this post


Link to post
Share on other sites
Here is the exact code:

//HelloWorld Program
#include<windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nShowCmd)
{
MessageBox(NULL, "Motoko Kusanagi has hacked your system!",
"Public Security Section 9",MB_OK|MB_ICONEXCLAMATION);
}









"fatal error C1083: Cannot open include file: 'windows.h': No such file or directory" also what dose this mean

Share this post


Link to post
Share on other sites
I think it's not finding the windows.h file which is in the platform SDK. You can add them in via the project properties or an easier way is to copy the platformSDK folder into this folder.

\program files\Microsoft Visual Studio 8\VC

So what you end up with is

\program files\Microsoft Visual Studio 8\VC\PlatformSDK

Share this post


Link to post
Share on other sites
Quote:
Original post by Chris27
I think it's not finding the windows.h file which is in the platform SDK. You can add them in via the project properties or an easier way is to copy the platformSDK folder into this folder.

\program files\Microsoft Visual Studio 8\VC

So what you end up with is

\program files\Microsoft Visual Studio 8\VC\PlatformSDK

Where do i find the platformSDK folder

Microsoft Platform SDK for Windows Server 2003 R2, is this what its called

Share this post


Link to post
Share on other sites
Actually there should be a folder called Microsft PlatformSDK in the program files folder or something similiar. What you want to do is create a folder called PlatformSDK where I showed you. After that copy all the files in the Microsoft PlatformSDK folder and copy them into the one you created.

Share this post


Link to post
Share on other sites
i copied the Microsoft Platform SDK for Windows Server 2003 R2 file in the \program files\Microsoft Visual Studio 8\VC, but it did not help

also this is another program i tried to run:
#include <iostream>

using namespace std;

int main()
{
int thisisanumber;

cout<<"Please enter a number: ";
cin>> thisisanumber;
cin.ignore();
cout<<"You entered: "<< thisisanumber <<"\n";
cin.get();
}


But i got this message
1>------ Build started: Project: 77, Configuration: Debug Win32 ------
1>Linking...
1>LINK : fatal error LNK1104: cannot open file 'user32.lib'
1>Build log was saved at "file://c:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin\77\77\Debug\BuildLog.htm"
1>77 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



it also says that the system can not find the path specified when i try to run any program

Share this post


Link to post
Share on other sites
I'm going to and uninstall and delete everything and start from scratch
Edit/Delete Message

Share this post


Link to post
Share on other sites
Quote:
Original post by 91chris91
I'm going to and uninstall and delete everything and start from scratch
Edit/Delete Message


Why? That won't help at all. All you probably need to do at this point is add the directory containing the Platform SDK library files to the compiler search path (try going to Tools->Options->Projects and Directories->VC++ Directories).

Share this post


Link to post
Share on other sites
Quote:
Original post by Captain_Thunder
Quote:
Original post by 91chris91
I'm going to and uninstall and delete everything and start from scratch
Edit/Delete Message


Why? That won't help at all. All you probably need to do at this point is add the directory containing the Platform SDK library files to the compiler search path (try going to Tools->Options->Projects and Directories->VC++ Directories).


i think the mistake i made was when i was doing step 3 i put the directors in the Visual Studio projects location, VS user project templates, and VS user item templates location.

now i put the directors in the right place but i don't know what to put in the Visual Studio projects location, VS user project templates, and VS user item templates location.

also what dose this mean:
"Unable to start program 'c:/documents and settings/chris/my documents/visual studio 2005/projects/77/debug/77.exe'.

The system cannot find the file specified."

[Edited by - 91chris91 on June 14, 2007 7:35:32 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement