A Conversation for The H2G2 Programmers' Corner

Classes help!

Post 1

Annette

I had a program with a lot of classes in it that was working perfectly. I transferred it to my laptop (which has the same compiler program) and tried to compile it there, got over 100 errors. The compiler messages said that all the classes I'd defined didn't exist. I've been trying to figure this out for several days and am going CRAZY. Does anyone know of something that could make a C++ compiler (Microsoft Visual Studio C++) not recognize classes??
Any suggestions would be GREATLY appreciated.


Classes help!

Post 2

Dogster

No idea I'm afraid. If you could give us the exact error messages and the bit in your code where you define the classes it isn't recognising we might be able to help. The only possibility that immediately occurs to me is that if your versions of MSVC++ are slightly different (e.g. you installed a service pack on one and not the other) then its behaviour would be different. It might be something to do with comments, e.g.

/*
...
// */

might not be recognised as the end of a comment, or:

/* /* */ */

might be handled differently in one version. Some C++ compilers enable you to nest comments like this, but it's not standard so you should get rid of this sort of thing if you see it.

The other possibility is that the transfer had an error in it. Check the filesizes are the same and the checksums if you have a program to do that, or just try copying again.


Classes help!

Post 3

xyroth

I would guess that either the compiler versions are different, so that something your classes were built from is not their, or that you forgot to copy one of your files, typically something library related.


Key: Complain about this post

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more