CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Oct 2008
    Posts
    17

    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.

  2. #2
    Join Date
    Apr 2008
    Posts
    118

    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.

  3. #3
    Join Date
    Oct 2008
    Posts
    17

    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.

  4. #4
    Join Date
    Apr 2008
    Posts
    118

    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.

  5. #5
    Join Date
    Oct 2008
    Posts
    17

    Unhappy 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.

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    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

  7. #7
    Join Date
    Oct 2008
    Posts
    17

    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.

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    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

  9. #9
    Join Date
    Oct 2008
    Posts
    17

    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.

  10. #10
    Join Date
    Oct 2008
    Posts
    17

    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.

  11. #11
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: C1004: unexpected end of file found

    Quote 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

  12. #12
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: C1004: unexpected end of file found

    Quote 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
  •  





Click Here to Expand Forum to Full Width

Featured