|
-
October 15th, 2008, 04:12 AM
#1
C1004: unexpected end of file found
I am attempting to get my old brain around Visual Studio .Net and have produced the following code but cannot get it to build. .Net returns C1004: unexpected end of file found.
Code:
#include "stdafx.h"
#include <ocilib.h>
#using <mscorlib.dll>
using namespace System;
int _tmain(int argc, char *argv[])
{
OCI_Connection* cn;
OCI_Statement* st;
OCI_Resultset* rs;
int Counter = 0;
int ret;
FILE *TablesFile;
char *Database, *UserName, *UserPassword, *StartDate,*EndDate;
char Message[256] = "";
/* for (i=0; i<argc; i++)
* {
* printf("%d %s\n", i, argv[i]);
* }
*/
Database = argv[1];
UserName = argv[2];
UserPassword = argv[3];
StartDate = argv[4];
EndDate = argv[5];
OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT);
cn = OCI_ConnectionCreate(Database, UserName, UserPassword, OCI_SESSION_DEFAULT);
st = OCI_StatementCreate(cn);
sprintf(Message, "select MemNumber,Turnover from (select mem_number MemNumber,sum(trans_turnover) Turnover from members join transact on mem_number = trans_code where Trans_date between '%s' and '%s' and mem_barred = 0 group by mem_number order by turnover desc ) where rownum <=200", StartDate, EndDate);
// printf("%s\n",Message);
OCI_ExecuteStmt(st, Message);
// OCI_ExecuteStmt(st,"select MemNumber,Turnover from (select mem_number MemNumber,sum(trans_turnover) Turnover from members join transact on mem_number = trans_code where Trans_date between '01-Jan-2004' and '14-Oct-2008' and mem_barred = 0 group by mem_number order by turnover desc ) where rownum < 201");
rs = OCI_GetResultset(st);
// printf("OCI_GetResultset() returns rs = %x\n", rs);
TablesFile = fopen("Tables.html", "wt");
while (OCI_FetchNext(rs))
{
fprintf(TablesFile, "% 4d - %u\n", ++Counter, OCI_GetDouble(rs, 1));
}
ret = fclose(TablesFile);
OCI_Cleanup();
return EXIT_SUCCESS;
}
and as hard as I look I cannot see a missing or additional brace.
-
October 15th, 2008, 04:31 AM
#2
Re: C1004: unexpected end of file found
This could be an issue with non-printing end-of-line characters.
Try pressing enter a few times after the last brace.
-
October 15th, 2008, 04:51 AM
#3
Re: C1004: unexpected end of file found
Thanks for the suggestion, Moschops, but that did not change anything. I still get the C1004 error message.
-
October 15th, 2008, 05:31 AM
#4
Re: C1004: unexpected end of file found
Did you definitely delete everything after the final brace first, including all white space?
Failing that, open the source file in a text editor that displays all characters, including non-printing characters, and see if there's anything hanging around.
-
October 15th, 2008, 05:40 AM
#5
Re: C1004: unexpected end of file found
I deleted everything up to and including the last brace and then replaced said last brace and still get the same error message. I have also edited the source in both other editors in the Windows environment as well as using some Linux editors and can find nothing untoward.
-
October 15th, 2008, 05:46 AM
#6
Re: C1004: unexpected end of file found
Comment out the whole _tmain body between "{" and the return. So it will look like:
Code:
int _tmain(int argc, char *argv[])
{
return EXIT_SUCCESS;
}
and try to compile.
...
Then uncomment lines subsequently one-by-one and compile again...
Victor Nijegorodov
-
October 15th, 2008, 05:58 AM
#7
Re: C1004: unexpected end of file found
The code now looks like
Code:
#using <mscorlib.dll>
using namespace System;
int _tmain()
{
return EXIT_SUCCESS;
}
and I still get the same error message.
and I have also gone to the extreme of
Code:
int _tmain()
{
return EXIT_SUCCESS;
}
same problem.
Leaves me to ask does .Net 1.1 actually work?
Last edited by straygrey; October 15th, 2008 at 06:01 AM.
-
October 15th, 2008, 06:05 AM
#8
Re: C1004: unexpected end of file found
This code (copy/paste from yours):
Code:
#include "stdafx.h"
#include <stdlib.h>
//#using <mscorlib.dll>
//using namespace System;
int _tmain(int argc, char *argv[])
{
return EXIT_SUCCESS;
}
compiles without the problem.
So, your problem appears to be in either
Code:
#using <mscorlib.dll>
or in
Code:
using namespace System
Victor Nijegorodov
-
October 15th, 2008, 06:13 AM
#9
Re: C1004: unexpected end of file found
As I said in my previous message I have cut my code down to
Code:
int _tmain()
{
return EXIT_SUCCESS;
}
and I still get the same error message.
-
October 15th, 2008, 06:45 AM
#10
Re: C1004: unexpected end of file found
Could either of adding support for CLR in the project properties or setting charset to myltibytes instead of unicode be the cause of my problem.
If so please tell me how do I set them.
-
October 15th, 2008, 06:46 AM
#11
Re: C1004: unexpected end of file found
 Originally Posted by straygrey
As I said in my previous message I have cut my code down to ...
You said it toooo late! (at 1:01 while I already was written my last post to you )
Victor Nijegorodov
-
October 15th, 2008, 07:09 AM
#12
Re: C1004: unexpected end of file found
 Originally Posted by straygrey
As I said in my previous message I have cut my code down to
Code:
int _tmain()
{
return EXIT_SUCCESS;
}
and I still get the same error message.
The problem could be in one of your header files.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|