Re: Why does VS2005 show errors in standard include files?????
Bo Berglund wrote:
:: I am a total newbie with Visual Studio 2005, but I have to use it
:: to create a small test application with an x64 target since no
:: other tool I have can compile 64 bit apps for Windows.
:: The test application is for accessing a Sentinel software
:: protection key.
::
:: What I have done is this:
:: - Created a console application (simplest type of app possible)
:: - Put some printf statements into the main() function
:: - Added my own test code in additional c files
The default for the compiler is to compile .c files as C, and .cpp
files as C++. Did you include cstdio into the .c files?
Either name your files .cpp, or set the "compile as" options propely
in the project settings.
Bo Persson
:: - Added the SafeNet Sentinel support files (headers and lib files)
::
:: When I build this the VS2005 happily accepts my own code without
:: errors (I had some syntax problem that were detected at first).
::
:: But it generates 100+ errors from files it has supplied
:: itself!!!!!!!
::
:: Did Microsoft not proof-read these files before releasing VS2005
:: or is there some setting I have to do to tell it not to bother?
:: These files generate errors:
::
:: C:\Program Files\Microsoft Visual Studio 8\VC\include\cstdio
:: C:\Program Files\Microsoft Visual Studio 8\VC\include\cstdlib
::
:: And the error messages are very strange, all the same two messages:
::
:: C:\Program Files\Microsoft Visual Studio 8\VC\include\cstdlib(18) :
:: error C2143: syntax error : missing '{' before ':'
:: C:\Program Files\Microsoft Visual Studio 8\VC\include\cstdlib(18) :
:: error C2059: syntax error : ':'
::
:: Why does this happen and what does it mean?
::
:: My own code in main.cpp looks like this:
::
:: #include <iostream>
:: #include <fstream>
:: #include <string>
:: #include "KeyGlobals.h"
:: #include "AgiKey.h"
:: #include "spromeps.h"
::
:: int main(int argc, char* argv[])
:: {
:: setlocale(LC_ALL,"C"); // global settings
:: unsigned char AppNo;
:: unsigned short Value;
:: //Your code below
::
:: printf("Test program start\n");
:: AppNo = 1; //look for Application #1
:: if (CheckKey(AppNo))
:: {
:: Value = KeySerial();
:: printf("Key with Application # %d active found!\n",AppNo);
:: Value = KeySerial();
:: printf("Key serial number is: %X \n", Value);
:: Value = KeyLicense(AppNo);
:: printf("License of App # %d is: %X \n", AppNo, Value);
:: Value = KeyInfo(AppNo);
:: printf("Info of App # %d is: %X \n", AppNo, Value);
:: Value = KeyExpDate(AppNo);
:: printf("ExpDate of App # %d is: %X \n", AppNo, Value);
:: }else
:: printf("CheckKey failed for application # %d\n", AppNo);
::
::
:: printf("Test program done\n");
::
:: setlocale(LC_ALL,""); // Local preferences
:: return 0;
:: }
::
:: Any ideas/fixes/tips welcome!
::
:: /Bo
::
:: Bo Berglund
:: bo.berglund(at)nospam.telia.com