Wrox Programmer Forums
|
BOOK: Professional C++, 2nd Edition
This is the forum to discuss the Wrox book Professional C++, 2nd Edition by Marc Gregoire, Nicholas A. Solter, Scott J. Kleper ; ISBN: 978-1-1181-6995-7
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C++, 2nd Edition section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 1st, 2014, 06:02 AM
NerdZilla
Guest
 
Posts: n/a
Default Structs

Hi, I get a Error from the code of page 15 and 16 about structs, The code from the book works fine but when i try to make my one struct. And try to make the same program but with different variables and names it doesn't work. For Example I tried to change the name of the struct with the same code.

//Header File
typedef struct{
char firstInitial;
char middleInitial;
char lastInitial;
int employeeNumber;
int salary;
} EmployeeD; (Changed from EmployeeT)

cpp File

#include <iostream>
#include "employeestruct.h"
using namespace std;

int main ()
{
// create and populate an employee
EmployeeD anEmployee; ......

After this it gave my an error message:
error: expected ';' before 'anEmployee',
error: 'EmployeeD' was not declared in this scope and
error: 'anEmployee' was not declared in this scope

Can somebody explain this ?
 
Old May 3rd, 2014, 05:21 AM
Wrox Author
 
Join Date: Mar 2011
Posts: 49
Thanks: 0
Thanked 4 Times in 4 Posts
Default

You are including "employeestruct.h".
Are you sure you changed it to EmployeeD in that "employeestruct.h" header file and not in another header file?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Enums VS Structs MoDulus Intro Programming 4 January 19th, 2012 10:42 AM
Structs Will BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 4 January 12th, 2010 03:12 PM
arrays of structs seymour_glass C# 2 April 2nd, 2007 08:14 PM
SizeOf Structs CDMBR C# 1 February 21st, 2007 06:24 PM
declaring structs scoobie C++ Programming 3 April 6th, 2006 12:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.