Programm läuft nicht! warum????
-
Hallo
Kann mir jemand sagen, warum daß Programm nicht geht???
Habe das Programm in einer Win32 Application erstellt.
Bekomme die Fehlermeldungen:error C2146:syntax error : missing ';' before identifiere 'SS'
error C2501:'CSpreadSheet' : missing storage-class or type specifiers
error C1004:unexpected end of file foundProgramm Herkunft:
http://www.codeguru.com/mfc_database/CSpreadSheet.html#include<afxdb.h>
// Create a new Excel spreadsheet, filename is test.xls,
// sheetname is TestSheet
CSpreadSheet SS("Test.xls", "TestSheet");// Fill a sample 5 by 5 sheet
CStringArray sampleArray, testRow, Rows, Column;
CString tempString;
char alphabet = 'A';SS.BeginTransaction();
for (int i = 1; i <= 5; i++)
{
sampleArray.RemoveAll();
for (int j = 1; j <= 5; j++)
{
tempString.Format("%c%d", alphabet++, i);
sampleArray.Add(tempString);
}
alphabet = 'A';
if (i == 1) // Add header rows
{
SS.AddHeaders(sampleArray);
}
else // Add data rows
{
SS.AddRow(sampleArray);
}
}// Set up test row for appending, inserting and replacing
for (int k = 1; k <= 5; k++)
{
testRow.Add("Test");
}SS.AddRow(testRow); // append test row to spreadsheet
SS.AddRow(testRow, 2); // insert test row into second
// row of spreadsheet
SS.AddRow(testRow, 4, true); // replace fourth row of
// spreadsheet with test rowSS.Committ();
SS.Convert(";"); // convert Excel spreadsheet
// into text delimited format
// with ; as separator// print out total number of rows
printf("Total number of rows = %d\n\n", SS.GetTotalRows());// Print out entire spreadsheet
for (i = 1; i <= SS.GetTotalRows(); i++)
{
// Read row
SS.ReadRow(Rows, i);
for (int j = 1; j <= Rows.GetSize(); j++)
{
if (j != Rows.GetSize())
{
printf("%s\t", Rows.GetAt(j-1));
}
else
{
printf("%s\n", Rows.GetAt(j-1));
}
}
}// print out total number of columns
printf("\nTotal number of columns = %d\n\n", SS.GetTotalColumns());// Read and print out contents of second column of spreadsheet
SS.ReadColumn(Column, 2);
for (i = 0; i < Column.GetSize(); i++)
{
printf("Column 2 row %d: %s\n", i+1, Column.GetAt(i));
}// Read in and print out the cell value at column 3,
// row 3 of spreadsheet
if (SS.ReadCell(tempString, 3, 3))
{
printf("\nCell value at (3,3): %s\n", tempString);
}
else
{
// print out error message if cell value cannot be read
printf("Error: %s\n", SS.GetLastError);
}
-
Typischer Fehler wenn der Compiler den Datentypen nicht kennt.
Du mußt wohl noch ein Headerfile includen in dem CSpreadSheet definiert ist. Oder vielleicht gehört CSpreadSheet auch in irgend einen Namespace (z.B. **std::**string).
-
Kann mir jemand sagen, was ich für ein Headerfile noch includen muß???
Danke für die Antwort übrigens
-
Wohin mit meiner Frage?
Welches Forum wünschen der Herr? Der Thread wird dan umgehend dort hin verschoben
-
@tho300
Du kannst anstatt
#include<afxdb.h>
#include<CSpreadShet.h> nehmen.MfG Lem
-
Wenn ich das so mache wie Du sagst bekomme ich die Fehlermeldung
Cannot open include file: 'CSpreadShet.h': No such file or directory Error executing cl.exe.
-
#include "stdafx.h"
#include "afximpl.h"
#include "winhand_.h"
#include "oleimpl2.h"
#include "ctlimpl.h"
#include "dbimpl.h"
#include "daoimpl.h"
#include "sockimpl.h"
#include<CSpreadShet.h>jetzt bin ich schon ein bißchen weiter.
Bekomme jetzt aber 33 Fehler.
z.B:c:\programme\microsoft visual studio\myprojects\datenbank\afximpl.h(18) : error C2011: 'AUX_DATA' : 'struct' type redefinition
-
Ich würde sagen, dass du nicht die CSpreadShet sondern die CSpreadSheet benötigst ( wenn überhaupt
).
also
#include <CSpreadSheet.h>
@Dimah
Ich würde sagen MFC