473,394 Members | 1,226 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

expected primary-expression before "void"

I cannot figure this out.

I have the following code:

<code>
Private:
/************************************************** ****************************
CreateList

Inputs:
Outputs: None
Notes: Creates an empty linked list with no nodes

************************************************** ****************************/
void CreateList(ListType *list);

</code>

which is in the header of my file. I get the error:
\JobCollection.h expected primary-expression before "void"

What is causing the error?
What is a 'Primary' expression?
I have tried removing the void, still have an error. I put the void in
the function in the .cpp, I get the error, I take it out of the .cpp I
get the error.

I cannot figure this out...

Oct 5 '06 #1
3 20939
sa***@murdocks.on.ca wrote:
I cannot figure this out.

I have the following code:

<code>
Private:

What is 'Private:' ?

Has 'ListType' already been defined?

Is this code snip INSIDE a 'class' or 'struct'
definition (I hope so...)? For example:

struct myStruct
{
private:

void CreateList(ListType *list);

/* other stuff for struct myStruct here */
};
>

/************************************************** ****************************
CreateList

Inputs:
Outputs: None
Notes: Creates an empty linked list with no nodes

************************************************** ****************************/
void CreateList(ListType *list);

</code>

which is in the header of my file. I get the error:
\JobCollection.h expected primary-expression before "void"

What is causing the error?
What is a 'Primary' expression?
I have tried removing the void, still have an error. I put the void in
the function in the .cpp, I get the error, I take it out of the .cpp I
get the error.

I cannot figure this out...
Oct 5 '06 #2

Larry Smith wrote:
Is this code snip INSIDE a 'class' or 'struct'
definition (I hope so...)? For example:

struct myStruct
{
private:

void CreateList(ListType *list);

/* other stuff for struct myStruct here */
};
Thanks for replying. I managed to fix that problem. Now I am posting a
new one.

I am a student and I think my brain is on overflow from syntax errors.

Oct 5 '06 #3

sa***@murdocks.on.ca wrote:
struct myStruct
{
private:

void CreateList(ListType *list);

/* other stuff for struct myStruct here */
};
out of interest why did you use struct rather than class. While it's
true that they are exactly the same apart from default access and
inheritance, it seems more natural to use class.
I am a student and I think my brain is on overflow from syntax errors.
Don't worry, I am a seasoned programmer and it's extremely rare that I
right a bunch of code and not have any syntax errors when you get to
compile it.

Sometimes the compilers don't always tell you what your actual error
is. For example, looking at the declaration it is obvious to me that
CreateList is a function name and ListType is a type. If ListType has
not been declared I would like compilers to give:

ListType: undefined type.

rather than some other message.

Oct 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: andy.herrera | last post by:
I'm getting this Error Message. Expected ';' Please Select One: <form name="form1"> <<------------ Error is here. <select name="selectTrans" onChange="If (this.value == 'checkout')...
3
by: Jon | last post by:
I'm learning about datatables. When using the example provided by MS in the ..NET Framework Class Library for DATATABLE (see below) I get an error on line 3 that says "Type expected". Is something...
7
by: Warrax | last post by:
I am currently doing online tutorials for C++, and am pretty much stuck in a rut about this problem. It is saying that there's an expected unqualifed-id before '{' token (I will post the code in just...
1
by: JOJO123 | last post by:
I got here in search of an answer to this Javascrpt question. I upgraded jave on XP Ie 7, acrobat 5.1 and suddenly can't open any pdf files on web sites using IE. I see u guys all say, this is a...
6
by: Lawrence Spector | last post by:
I ran into a problem using g++. Visual Studio 2005 never complained about this, but with g++ I ran into this error. I can't figure out if I've done something wrong or if this is a compiler bug. ...
5
by: amitmool | last post by:
hi, i have used the queue library file and try to use the template as template <class QueueItem> queue <QueueItem>::~queue() // line 25 { } template <class QueueItem> void...
1
by: Hunternora | last post by:
I'm just trying to count letters, by type etc. What am I doing wrong here? import javax.swing.JOptionPane; public class Asg3 { public static void main(String args) { int aCount=0,...
10
by: preeya | last post by:
Hi, I have written the following program: ------------------------------------------------------------------------------------------------------------- 1 #include <stdio.h> 2 #include...
9
by: erictheone | last post by:
Ok so what I'm trying to do is create a trans location cipher. For those among us that don't know alot about cryptography it is a method for jumbling up letters to disguise linguistic...
1
by: rameshjumgam | last post by:
i am having in my code like std::list<T*>::const_iterator iter=lst.begin(); and i am getting error error: expected `;' before âiterâ /root/INCLUDE/cw/gdlist.h:140: error: âiterâ was...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.