Visual Studio C++ 2005 problem?

Why am I getting this error on such a simple program

Page 1 of 1

4 Replies - 1231 Views - Last Post: 20 February 2009 - 02:41 PM Rate Topic: -----

#1 kmullin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 20-February 09

Visual Studio C++ 2005 problem?

Post icon  Posted 20 February 2009 - 12:50 PM

I'm new to Visual Studio C++ 2005, and I'm getting an error on this simple program that I just don't understand:

// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include "stdafx.h"

#using <mscorlib.dll>
#include <tchar.h>

using namespace System;


int main()
{

return 0;

}

I mean, it can't get much simpler than this, but I get this error when I comple it:

c:\Documents and Settings\Kevin Mullin\My Documents\Data\CPlusPlus\ch02\carrots.cpp(11): fatal error C1075: end of file found before the left brace '{' at 'ch02\carrots.cpp(10)' was matched

Funny thing is, I don't get this error if I use the model code that visual c++ gives you. The first 10 lines of my program were copied from it. What is going on?

I think I found the problem. It is the new-line character. The program was downloaded from a site related to a book I'm reading on C++. When I pulled that file up in notepad, everything was on a single line, with a funny character where the new-line should be. I think that is the problem :)

Is This A Good Question/Topic? 0
  • +

Replies To: Visual Studio C++ 2005 problem?

#2 musya  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 11
  • View blog
  • Posts: 1,012
  • Joined: 25-April 07

Re: Visual Studio C++ 2005 problem?

Posted 20 February 2009 - 01:33 PM

Try erasing that character and then putting that code into vc++ also try doing it without the
#using <mscorlib.dll>
#include <tchar.h>

first to see if that helps any.
Was This Post Helpful? 0
  • +
  • -

#3 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Re: Visual Studio C++ 2005 problem?

Posted 20 February 2009 - 01:33 PM

What's in your #include "stadfx.h"?
Was This Post Helpful? 0
  • +
  • -

#4 musya  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 11
  • View blog
  • Posts: 1,012
  • Joined: 25-April 07

Re: Visual Studio C++ 2005 problem?

Posted 20 February 2009 - 02:22 PM

View PostKYA, on 20 Feb, 2009 - 12:33 PM, said:

What's in your #include "stadfx.h"?


Thats a common c library
Was This Post Helpful? 0
  • +
  • -

#5 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Re: Visual Studio C++ 2005 problem?

Posted 20 February 2009 - 02:41 PM

What? No its not. Create a new project in Visual Studio. It's added as a standard file. The programmer is free to add whatever they want to it. I've seen people add something, forget about it, and that be the crux of whatever problem they're having.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1