Sign in to follow this  
yeeha_sf

really stuck on visual C++ 6.0

Recommended Posts

As I read in the very first lesson, I should make a windows 32 application, add 3 libraries on place and even though I wrote the code in the lesson letter by letter just to try doing it all alone, but whatever I try the program simply doesnt work. I was wondering what 's really best like a start - an empty or simple application from the wizzard, even does it have to be a win32 or win32 console application, but its interesting that I 've got all the variety of errors that 's possible - there is an overall of 3 variations : first, program 's getting stuck om compilation, for this one saying something s wrong with some previewed header files or somethin'... Second, getting stuck on building, for this one saying something 's wrong with main_ I dunno what and a second error, I dont remember what, but that 's generally what 's happenning. And finally, the third variation, the most frustrating, because it actually compiles and builds everything, even asking fullscreen or not, but then comes the rout - failed to register some class, you know, I think that program 's very buggy and maybe it even hates me already - I don 't have an explanation for any of these - my main problem is no matter how I fight, I never get the blessed .EXE file ready and working - the only way I 'm getting it is by writting some simple and nothing-doing program, and I can 't get a clue how did NeHe manage to create, hold and even make the .EXE file work even without the need for the .CPP file to be checked and clean - I 've tried everything and I 'm really stuck...

Share this post


Link to post
Share on other sites
Visual C++ 6.0 was released in 1998. There are far better tools available to you now, for free. I would recommend you go pick up Visual C++ 2008 Express Edition. Your problems appear to be with manipulating the UI; a modern toolkit will allow people here to help you more effectively and be of more use to you (there have been a lot of improvements to VC++ since 1998!).

EDIT: Paragraph breaks also help make your posts easier for people to understand. :)

Share this post


Link to post
Share on other sites
Visual C++ 6.0 is VERY outdated. Not to say it shouldn't be working fine, but you might find better documentation and a world of people who can help you if you have a more recent version.

The Visual Studio Express versions are free to download, go ask microsoft.com

Share this post


Link to post
Share on other sites
Step 1: Uninstall VC 6.
Step 2: Take VC6 CD and break it in half
Step 3: Burn the remains of the CD
Step 4: Download Visual Studio 2008 and install it.

VC6 is an absolutely terrible compiler. It came out before the first C++ standard (Over 10 years ago), so it's extremely non-compliant; particularly with templates. It doesn't optimise (Unless you have the professional version) whereas the free version of VC2008 does, it produces incorrect code in some cases, it crashes frequently, and a lot of SDKs and APIs don't support it at all (E.g. DirectX).

EDIT: Bah, too slow [smile]

Share this post


Link to post
Share on other sites
Quote:
Original post by yeeha_sf first, program 's getting stuck om compilation, for this one saying something s wrong with some previewed header files or somethin'...


What is the error reported?

Quote:
Second, getting stuck on building, for this one saying something 's wrong with main_ I dunno what


What is the error reported?

Quote:
and a second error, I dont remember what, but that 's generally what 's happenning.


What is the error reported?

[quote]And finally, the third variation, the most frustrating, because it actually compiles and builds everything, even asking fullscreen or not, but then comes the rout - failed to register some class[quote]

What is the error reported?

Quote:
and clean - I 've tried everything and I 'm really stuck...


You forgot to list the errors reported.

In same style, one reply to this could be: Fix the problems and it'll work fine.

But when you get an error message, something like 'C4531: Could not....', put that into google. If it's a common problem, it should put you on right track to fixing it.

Share this post


Link to post
Share on other sites
You know, there are mainly two reasons for why Ï was relying so much on 6.0 - firstly, those very first lessons here on the site are exactly about this version and I was actually relying on them. And secondly, everything free that I found over the net looks just as aged as these lessons. Maybe there are some newer versions of those three great books - green, blue and red, mainly red, because you see, my problem is I can't even start from somewhere so that I can be online with every new version, but I 'll try to find something more fresh like books and programs, although the newer they are, the harder for me like a non-specialist.

Share this post


Link to post
Share on other sites
Unfortunately when it comes to programming the world changes very quickly. In 5 years time API's will have new versions and could be radically different, and newer tools will be out that make the old ones outdated. I understand it's probably difficult finding a place to jump in especially with so many outdated tutorials floating around, but trust me we're not steering you wrong by telling you to use the latest tools available. Using VC6 will only frustrate you to no end and will prevent others from helping you out (since we all abandoned VC6 years ago).

Share this post


Link to post
Share on other sites
Antheus, as listed in my first post, the errors are :

First :

c:\program files\microsoft visual studio\myprojects\fds\fds.cpp(291) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.

fds.obj - 1 error(s), 0 warning(s)

Second :

LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main

Debug/rewq.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

rewq.exe - 2 error(s), 0 warning(s)

Third :

like Message Box :

Error; Failed to register the window class;

I saw that was somewhere in the code, exactly like :

if(!RegisterClass(&wc))
{
MessageBox(...);
return FALSE;
}

Is there a way to make really working applications on 6.0 ?

Share this post


Link to post
Share on other sites
First: turn off precompiled headers in the project options.

Second: you must create a Windows application project (not a Console application project) when you use WinMain (as opposed to main).

Third: it sounds like you used a class name that is already in use or some other value you set in your WNDCLASS structure is invalid.

Fourth: get rid of VC6.

Share this post


Link to post
Share on other sites
I used VC++ 6 pretty heavily for the last 5 years and it worked well enough. I had created some fairly massive sets of game applications/servers/clients/editors/utilities and examined quite a few examples form various gam programming books.

Lots of online samples (many dozens I tried) were still available which worked in VC++6 without many changes.
I sometimes had problems converting other sample program's project files back into the old format (often I just built new projects).
I always figured that when I needed optimization, I would then convert to the latest (or to the Intel one). My large project still hasnt reached the point that this is needed.

I recently installed the VC++8 express freebie compiler (and the DirectX10 SDK)to see what had changed interface-wise and was relieved to see much of it operated the same way.

Its actually funny because I will be using clustered computers to run AI in my project and I will have to convert large chunks of code/applications to run on Linux. Fortunately those are number crunchers which have only a network+console interface. I also mostly program C++ like C and dont use Templates so conversions shouldnt be too bad (I had previously spot tested some of my code on 'compliant' compilers and had virtually no changes to make.)

Share this post


Link to post
Share on other sites
wodinoneeye, you really must be some kind of wizzard for what you 're saying and it sounds really great, but I 'm telling you I can 't make even one program work on VC++6.0 - it 's unexplainable to me how exactly the effect with the .EXE file is achieved in the downloadable code from lesson1, but I already mentioned that, whatever... I just have some last questions - like an all-new beginner, can you recommend me the best latest OpenGL book about C++, is that the 5th edition of the Red book or there are better books, but also good as explaining things to guys like me? And also, are C++ materials too far away from Java ones? Because you see, I have the nearly latest Java tools, but when I can 't use them - is there, say, some equivalent to the latest Red book, but in Java variataion and can you recommend me something? The latest version of OpenGL is 2.0, is it? I 'm definitely going to update my C++ tools, but after I 'll be starting from newer versions, I 'm going to need some very well explaining materials.

Share this post


Link to post
Share on other sites
Create a new project make sure that it is a win32 project and not a console project.

Create all the files you need from the old project and copy past the code.

Change the name you used for the windows class because it sounds like your using a reserved name.

Build and run the new project.

And as was said get rid of 6.0 and move up to something that is more compliant with the c++ standard. It will only help you in the end.

If you one of those people that said "I don't want the free thing" take it from someone that has used the free and pro version of 2005/2008 the things missing from the free version are just extras that most people will never find a use for anyway.

Share this post


Link to post
Share on other sites
Everything put in the wizzards by just clicking next, next, ..., finish is working just fine, but that 's just because there 's no other way - you did nothing to change it - but when I try writing some long and serious programming code that will do much more than just 'hello world', the errors' fest is in rush hour, if you know what I mean... And I 'm pretty sure there 's no problem with the code itself, because you see, sometimes I even reach 'fullscreen or not', meaning the program 's going very far, but obviously not far enough, but also, even stronger proof - when I open the .CPP file from NeHe 's code, it 's producing exactly the same kinda three variations that I already stated above, but you know, I don 't even have to compile, nor to OPEN the .CPP file, because all I need is to open the .EXE file and with or without a .CPP file the program 's working just fine - I mean what 's the whole program and the goal - to look at the picture in the window - so that 's exactly what 's most magic-looking to me - the wonderful .EXE effect...

Share this post


Link to post
Share on other sites
Quote:
Everything put in the wizzards by just clicking next, next, ..., finish is working just fine,
One would hope so. If the IDE is unable to create a working template, you have a more troublesome issue at hand.

Quote:
but when I try writing some long and serious programming code that will do much more than just 'hello world', the errors' fest is in rush hour, if you know what I mean...
Nope, we have zero idea what you mean. Contrary to what is shown in movies, programmers are not imbued with psychic abilities with a touch of magic here and there. You have some arbitrary problem, and we need to diagnose it somewhere else in the world. So: be accurate in your description. Be detailed, while remaining relevant and concise.

If you are writing code that is supposed to work, but doesn't, here's what you need to do. You need to show us a demonstration snippet of code that you know definitely works. Indicate why you think it works. Tell us what you expected. And what you observed (not your attempt at diagnosis). And we can then try to help you.

Your post is unintelligible. Write coherently, in recognizable English sentences.

Share this post


Link to post
Share on other sites
oler1s, first : I didn 't want to repeat the whole errors' description that 's above in this page in one of my posts - if you need technical informatoin, it 's there. But I think I 'm really getting an explaination myself by returning to the program again and again - actually, let 's say the other two error variations have gone already because I 'm now creating only win32 (not console) empty apps and changing the .CPP file 's name to a different from the project 's name. I mean the last error left is when it compiles and builds the program and boom - "Failed to register the window class." - so the only place in my program corresponding to this result is :

wc.lpszClassName = "OpenGL";

if( !RegisterClass(&wc) )
{
MessageBox( NULL, "Failed to register the window
class.", "Error", MB_OK|MB_ICONEXCLAMATION );
return false;
}

Now look at the downloadable version - is there any difference :

wc.lpszClassName = "OpenGL"; // Set The Class Name

if (!RegisterClass(&wc)) // Attempt To Register The Window Class
{
MessageBox(NULL,"Failed To Register The Window
Class.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}

After my version doesn 't work but the downloadable one does, I think now you 'll understand better why I 'm calling this magic...

[Edited by - yeeha_sf on May 16, 2008 4:48:24 AM]

Share this post


Link to post
Share on other sites
There is more to setting up a valid WNDCLASS structure than just setting the class name field. As I mentioned in my previous post, it may be that some other field in that structure is invalid.

Share this post


Link to post
Share on other sites
I also have an upgrade question. I've been using VS.NET 2003 since it came out. I've gotten a newer C++ book for school last semester(I'm still a newbie) and it uses slighty a different syntax than my older books, like using "std:cout" instead of "using namespace std" which I am accustomed to. Would it be more benificial to me to get VS Express 08 and dump VS NET 03, or is there not enough difference to warrant the upgrade?

Share this post


Link to post
Share on other sites
Quote:
Original post by frubam
I also have an upgrade question. I've been using VS.NET 2003 since it came out. I've gotten a newer C++ book for school last semester(I'm still a newbie) and it uses slighty a different syntax than my older books, like using "std:cout" instead of "using namespace std" which I am accustomed to. Would it be more benificial to me to get VS Express 08 and dump VS NET 03, or is there not enough difference to warrant the upgrade?
The std::cout and using namespace std thing is just a style ting. You should really be using the std::cout version (Since using namespace std is a bit of a hack [It pollutes the global namespace]).
As far as VC2003 -> VC2008 goes, there's not a huge difference - code should still compile fine (Although VC2005 and VC2008 default to unicode character set, I think VC2003 uses Multi-byte, but you can change that in the project settings). I'd still recommend upgrading to VC2008, since it keeps you up to date - there's not been nearly as many changes in VC6 -> VC2002, but there's still a few. Plus, the more tools you know the better.
Personally, I'm still using VC2005, but only because I can't be bothered installing 2008 on the 3 machines I develop on, and I can't be bothered upgrading all of my projects to 2008.

Share this post


Link to post
Share on other sites
Thanks Evil Steve, I didn't know that. I'll start using "std::cout" from now on, though it'll probably be annoying until I get it into muscle memory :D.

I'd like to ask how "using namespace std" pollutes the global space, as I'm not really sure what that[pollution] entails. I've always just been told that global initializations are bad, and I shouldn't use them, but have never been given a reason why.

Share this post


Link to post
Share on other sites
Quote:
Original post by frubam

I'd like to ask how "using namespace std" pollutes the global space, as I'm not really sure what that[pollution] entails. I've always just been told that global initializations are bad, and I shouldn't use them, but have never been given a reason why.


Well the idea behind namespaces is that they prevent naming collisions for types and functions. The std namespace has a lot of classes and functions, some with very "generic" names like std::vector. The idea is that you don't want to simply say "give me every class and function in the standard library!" because you might get something with a name you'd like to use yourself (or that's used in a third-party library you're using). Therefore it's generally better practice to specifically state what you're using (for example "using std::vector;" or to simply put the namespace every time you use the class or function.

Share this post


Link to post
Share on other sites
Quote:
Original post by frubam
Thanks Evil Steve, I didn't know that. I'll start using "std::cout" from now on, though it'll probably be annoying until I get it into muscle memory :D.

I'd like to ask how "using namespace std" pollutes the global space, as I'm not really sure what that[pollution] entails. I've always just been told that global initializations are bad, and I shouldn't use them, but have never been given a reason why.
Doing "using namespace std" tells the compiler "Wherever you find an unrecognised symbol, see if it exists in the std namespace, as if I'd prefixed it with 'std::'" (Well, more or less). That can mean that some functions that are in the std namespace, like find() get confused with functions that you create called find().
The functions in the std namespace are designed to be referred to by the namespace name, which is why they have relatively simple names like find().

You can do "using std::cout;" as well, which means you don't want to have to type the std:: prefix only with cout, which is a lot more acceptable. But I'd still recommend against putting any "using" clauses in a header they should only go in a source file, so you don't accidentally pollute another .cpp file that includes that header.

If you have any more questions about this stuff, it might be better to start a new thread rather than taking this one off topic [smile]

Share this post


Link to post
Share on other sites
I get it now, thanks. I did notice when I'd use variable names or functions like count or length, it would show up as something different when I accessed it, but never knew why. Sorry for going off topic :( .

Share this post


Link to post
Share on other sites
OMG, Dave Hunt, I can 't believe ALL the time it 's been MY mistake - I missed only 1 but CRITICAL line and that 's the only thing that was breaking my program - I thought I had all the program rewritten exactly, but thanks to your tip I checked the exact place - I couldn 't really check it all - THANKS :

wc.hCursor = LoadCursor(NULL, IDC_ARROW);

NOW IT WORKS !

Share this post


Link to post
Share on other sites
Quote:
Original post by yeeha_sf
wodinoneeye, you really must be some kind of wizzard for what you 're saying and it sounds really great, but I 'm telling you I can 't make even one program work on VC++6.0 - it 's unexplainable to me how exactly the effect with the .EXE file is achieved in the downloadable code from lesson1, but I already mentioned that, whatever... I just have some last questions - like an all-new beginner, can you recommend me the best latest OpenGL book about C++, is that the 5th edition of the Red book or there are better books, but also good as explaining things to guys like me? And also, are C++ materials too far away from Java ones? Because you see, I have the nearly latest Java tools, but when I can 't use them - is there, say, some equivalent to the latest Red book, but in Java variataion and can you recommend me something? The latest version of OpenGL is 2.0, is it? I 'm definitely going to update my C++ tools, but after I 'll be starting from newer versions, I 'm going to need some very well explaining materials.


Man I wish my website was farther along after reading this post. If you can hold out a few weeks I will be posting a website with a lot of beginner stuff that starts from hello world and continues through to wherever I am currently at in learning. I make posts on it everytime I learn something new and describe what I learned, with plenty of exercises to try out as well. Unfortunatly I am still in the stage of catching it up to where I am at as well as ensuring all the information is as accurate as I can make it : /

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this