Advertisement

02.26.2005 at 12:14AM PST, ID: 21330035
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Visual C++ C1010 unexpected end of file while looking for precompiled header directive

Tags: file, end, unexpected, precompiled, while

Hi,
     I am a new bee to Visual C++, I have some problem.

This is my main program
----------------------------------------------------------------------------------------
#include "stdafx.h"
#include "parse.h"

int main(int argc, char* argv[])
{
      char first[100],second[100];
      first[0] = '\0',second[0]='\0';
      //second = new char[10];
      printf("Enter the string\n");
      scanf("%s",first);
      printf("The length of the string %s is %d\n",second,strlen(second));
      printf("The concatenated string is %s\n",concatenateN(first,6));
      return 0;
}
----------------------------------------------------------------------------------------
the declaration of concatenateN function is present in the include file parse.h

               parse.h
---------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <ctype.h>

char *concatenateN(char *,int );
----------------------------------------------------------------

the definition of the function is in parse.c
            parse.c
--------------------------------------------------------------
#include "parse.h"

char *concatenateN(char *str,int n)
{
      char *result = new char[strlen(str)*n+1];
      result[0] = '\0';
      for(int i=0;i<n;i++)
            result = strcat(result,str);
      return result;
}
--------------------------------------------------------------

When I compile this function I am getting the error:
parse.c(15) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.


Then I have included the file stdafx.h in parse.c, which changes the parse.c to

-------------------------------------------------------------
#include "parse.h"

char *concatenateN(char *str,int n)
{
      char *result = new char[strlen(str)*n+1];
      result[0] = '\0';
      for(int i=0;i<n;i++)
            result = strcat(result,str);
      return result;
}

#include <stdafx.h>
-------------------------------------------------------------
Now it is giving the error:
parse.c(14) : fatal error C1853: 'Debug/robots_parse.pch' is not a precompiled header file created with this compiler
Error executing cl.exe.

I searched in MSDN help, but am not able to understand it.

Thanks,
Dp
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: durgaprasad_j
Solution Provided By: AlexFM
Participating Experts: 1
Solution Grade: A
Views: 315
Translate:
Loading Advertisement...
02.26.2005 at 12:15AM PST, ID: 13409426

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.26.2005 at 12:21AM PST, ID: 13409443

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.26.2005 at 12:25AM PST, ID: 13409450

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.26.2005 at 12:37AM PST, ID: 13409468

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.26.2005 at 01:05AM PST, ID: 13409512

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.26.2005 at 08:25AM PST, ID: 13410836

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.26.2005 at 08:48AM PST, ID: 13410914

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.26.2005 at 09:06AM PST, ID: 13410974

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.26.2005 at 09:24AM PST, ID: 13411074

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.26.2005 at 09:39AM PST, ID: 13411119

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
02.26.2005 at 12:15AM PST, ID: 13409426

Rank: Wizard

Make Rebuild All.
 
02.26.2005 at 12:21AM PST, ID: 13409443

Rank: Wizard

#include <stdafx.h>

This line should be added to the beginning of the file:

#include <stdafx.h>
#include "parse.h"

Alternatively, you can turn off using precompiled headers for all project:
Project - Properties - Configuration Properties - C++ - Precompiled Headers - Create/Use Precompiled Header - Not Using Procompiled Headers.
Or turn off precompiled headers for specific file. Right-click on the file in the Solution explorer, Properties. Turn off precompiled headers by the same way.
Accepted Solution
 
02.26.2005 at 12:25AM PST, ID: 13409450

Rank: Wizard

Many VC++ users are confused by this feature. However, it allows to reduce compilation time significantly. You can see more information about precompiled headers here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_Creating_Precompiled_Header_Files.asp
 
02.26.2005 at 12:37AM PST, ID: 13409468
Rebuild All didn't work, and so is adding the #include<stdafx.h> line at the begining of the file.

If I check "Not using the precompiled headers"  it worked, but  won't that create any problems later??
 
02.26.2005 at 01:05AM PST, ID: 13409512

Rank: Wizard

This will not create problems, only slows down compilation. Try to play with another options like "Automatic use of precompiled headers" for this file.
Using of precompiled headers is important for windows programs, which have huge include files size. In your case, you have stdio.h, stdlib.h etc. and it is better to use precompiled headers as well.
 
02.26.2005 at 08:25AM PST, ID: 13410836
hi alexFM,

thanks for your great replys.

#include "stdafx.h"
#include "parse.h"

int main(int argc, char* argv[])
{
     char first[100],second[100];
     first[0] = '\0',second[0]='\0';
     //second = new char[10];
     printf("Enter the string\n");
     scanf("%s",first);
     printf("The length of the string %s is %d\n",second,strlen(second));
     printf("The concatenated string is %s\n",concatenateN(first,6));
     return 0;
}

In the above code, if i include  parse.h, its not working properly.
But if i include "parse.c" , its working properly.

what could be the reason??
In linux, that kind of code is working perfectly. But iam facing so many problems in windows :(((

Waiting for your reply
 
02.26.2005 at 08:48AM PST, ID: 13410914

Rank: Wizard

Please define what is "working properly" and "not working properly".
Usually c-files are not included to another source files. They are kept as part of the project. If parse.c is listed in the project files, and included into another file, you have linker error (duplicated function).
Ensure that parce.c is lisred in the project source files (use Project - Add function), and don't include it to another file.
The stuff you are working with is not different from Linux. You can turn off precompiled headers for all project and work exactly by the same way as in Linux - this is still C++.
 
02.26.2005 at 09:06AM PST, ID: 13410974
hi,

Last question.

In makefile , generally we compile all c files into .o files.
After that we compile all .o files.

In VC .. how can we do that here??

I hope iam clear
 
02.26.2005 at 09:24AM PST, ID: 13411074

Rank: Wizard

In VC++ you need to add all source files (c/cpp) to the project. These files are listed in the Solution Explorer (or Files View in VC++ 6.0). VC++ IDE takes care about generating makefile and calling of C++ compiler and linker.
C/cpp files are compiled to .obj files which you can see in Debug/Release directory. Linker makes executable file from .obj files.
 
02.26.2005 at 09:39AM PST, ID: 13411119
hi,
Thank you alexFm. Because of you i started my first program in VC
 
 
20080236-EE-VQP-29