Visual C++.NET: Strange errors when compiling a program

Started by
4 comments, last by Dave Hunt 18 years, 10 months ago
I'm trying to compile a program in Visual C++ .NET but I'm getting lots of errors. The problem is that none of these errors have to do with my program, they have to do with the .NET libraries. A few of the errors are... c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\List.h(37) : error C2146: syntax error : missing ';' before identifier 'Length' c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\List.h(37) : error C2501: '_LIST:WORD' : missing storage-class or type specifiers c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\List.h(37) : error C2501: '_LIST::Length' : missing storage-class or type specifiers Best regards, bory
Advertisement
Many times when the error indicates a file not written by you, you can safely assume the error is yours. Effectively all profesionally distributed libraries have been compiled and will work. So, always suspect your own coding. Then, next, suspect your own coding. Continue to do that for about a week and then start suspecting other things.

Also, the error message tells you the error occurs before the specified location. Probably, the error is in one of your files just before the specified header file is included. If I may try a bold guess, it is probably like this:

// In some header file of yours:class SomeClassOfYours{}// Look: a semicolon is missing on the previous line!// In some cpp file of yours#include "someheaderfileofyours"#include "List.h"


Such code will generate said error. Good luck! Greetz,

Illco
Yes, I assume that the error should be in my program, but if I compile the same program on another PC on which is installed the same Microsoft Visual Studio.NET 2003 it works ok.
I'll check again my code, thank you for your answer and time.

best regards,
bory
Ok that's more interesting perhaps. Maybe you can post an excerpt of the source around the error?
In one of my header files I use
#include <list.h> and that's were the problem begins.
For example later in the file I have:
struct SMessage
{
EMType messtype;
unsigned short address;
list <LInfo> info;
};
and first I have the errors :
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\List.h(37) : error C2146: syntax error : missing ';' before identifier 'Length'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\List.h(37) : error C2501: '_LIST::DWORD' : missing storage-class or type specifiers
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\List.h(37) : error C2501: '_LIST::Length' : missing storage-class or type specifiers
etc..
and after the errors for my header file wherever I use List:
z:coord.h(54) : error C2143: syntax error : missing ';' before '<'

You should use '<list>', not '<list.h>'.

This topic is closed to new replies.

Advertisement