473,569 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(List Type *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 20974
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(List Type *list);

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

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

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

*************** *************** *************** *************** *************** ***/
void CreateList(List Type *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(List Type *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(List Type *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
5203
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') window.location.href='CheckOut.php';"> <option>---Please Select One ---</option> <option value="checkout">Check OUT</option> <option value="checkin">Check...
3
3180
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 missing from the code? Thanks - Jon Private Sub MakeParentTable() ' Create a new DataTable. Dim myDataTable As Datatable = New...
7
92048
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 a second) on line 11, and an expected ',' or ';' before '{' token also on line 11, however I don't have a clue what the first one means. The program...
1
3893
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 Javscript issue. but how do we, mere mortals who know nothing of anything about Java, scripts, etc, fix this? Is there a programm, does MS have any fix?...
6
5313
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. Here's a very simple example which should illustrate what I'm doing. #include <iostream> template <class T> class TestBase {
5
7964
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 queue<QueueItem>::push(const QueueItem& entry) // line 42
1
1398
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, eCount=0, iCount=0, oCount=0, uCount=0, upperCount=0;
10
15739
by: preeya | last post by:
Hi, I have written the following program: ------------------------------------------------------------------------------------------------------------- 1 #include <stdio.h> 2 #include "abc.h" 3 4 void PROP_abc(double ptr)
9
27613
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 patterns(words). What it does is takes a string as a parameter, determines length of string, tests if the length is a perfect square, if it is then it makes a 2-d...
1
3295
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 not declared in this scope /root/INCLUDE/cw/gdlist.h:142: error: âiterâ was not declared in this scope
0
7612
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.