Join us at IRC!
Imagination is more valuable than knowledge - Albert Einstein
Wednesday, May 23, 2012
Navigation
Members Online
Total Online: 32
Web Spiders: 16
Guests Online: 30
Members Online: 2

Registered Members: 70170
Newest Member: bahmx
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

C++ compiling issue, Mac/codeblocks/GCC

Zkunxen
Member

Posts: 47
Location:
Joined: 24.07.09
Rank:
Elite
Posted on 09-10-09 00:38
I tried to recompile my cash register program, in which I'm now implimenting a linked list to keep track of what was added to the order, and I'm getting this long list of errors. the weird thing is, that the errors aren't in files I wrote, or am using, for the most part, as far as I can tell. here's the list of errors:

/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h:64: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++config.h:66: error: expected unqualified-id before 'namespace'
/usr/include/_locale.h:74: error: expected unqualified-id before string constant
/usr/include/locale.h:52: error: expected unqualified-id before string constant
/usr/include/c++/4.0.0/clocale:55: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/cstddef:50: error: expected unqualified-id before 'namespace'
/usr/include/string.h:80: error: expected unqualified-id before string constant
/usr/include/c++/4.0.0/cstring:77: error: expected unqualified-id before 'namespace'
/usr/include/stdio.h:165: error: expected unqualified-id before string constant
/usr/include/stdio.h:248: error: expected unqualified-id before string constant
/usr/include/stdio.h:307: error: expected unqualified-id before string constant
/usr/include/stdio.h:356: error: expected unqualified-id before string constant
/usr/include/stdio.h:371: error: expected unqualified-id before string constant
/usr/include/c++/4.0.0/cstdio:97: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/cstdio:153: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/cstdio:175: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h:47: error: expected unqualified-id before 'namespace'
/usr/include/sched.h:30: error: expected unqualified-id before string constant
/usr/include/time.h:113: error: storage class specified for 'tzname'
/usr/include/time.h:116: error: storage class specified for 'getdate_err'
/usr/include/time.h:118: error: storage class specified for 'timezone'
/usr/include/time.h:118: error: 'asm' specifiers are not permitted on non-static data members
/usr/include/time.h:120: error: storage class specified for 'daylight'
/usr/include/time.h:122: error: expected unqualified-id before string constant
/usr/include/pthread.h:148: error: expected unqualified-id before string constant
/usr/include/unistd.h:414: error: expected unqualified-id before string constant
/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++io.h:39: error: expected unqualified-id before 'namespace'
/usr/include/runetype.h:131: error: expected unqualified-id before string constant
/usr/include/ctype.h:145: error: expected unqualified-id before string constant
/usr/include/ctype.h:164: error: expected unqualified-id before string constant
/usr/include/ctype.h:204: error: expected unqualified-id before string constant
/usr/include/c++/4.0.0/cctype:66: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/bits/stringfwd.h:46: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/ctime:64: error: expected unqualified-id before 'namespace'
/usr/include/_wctype.h:176: error: expected unqualified-id before string constant
/usr/include/wchar.h:116: error: expected unqualified-id before string constant
/usr/include/c++/4.0.0/cwchar:69: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/cwchar:141: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/cwchar:242: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/cwchar:263: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/bits/postypes.h:52: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/bits/functexcept.h:43: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/iosfwd:52: error: expected unqualified-id before 'namespace'
/usr/include/c++/4.0.0/exception:42: error: expected unqualified-id before string constant
/usr/include/sys/signal.h:412: error: expected unqualified-id before string constant
/usr/include/sys/resource.h:235: error: expected unqualified-id before string constant
/usr/include/sys/wait.h:254: error: expected unqualified-id before string constant
/usr/include/alloca.h:35: error: expected unqualified-id before string constant
/usr/include/stdlib.h:134: error: storage class specified for '__mb_cur_max'
/usr/include/stdlib.h:144: error: expected unqualified-id before string constant
Process terminated with status 1 (0 minutes, 1 seconds)
50 errors, 0 warnings

What could cause this?
Author

RE: C++ compiling issue, Mac/codeblocks/GCC

stealth-
Member



Posts: 995
Location: Eh?
Joined: 10.04.09
Rank:
God
Posted on 09-10-09 02:08
I know in python that using a imported function in the wrong way can cause errors in that file, not yours, even though the root of the problem is your file.

This might be something similar here?


The irony of man's condition is that the deepest need is to be free of the anxiety of death and annihilation; but it is life itself which awakens it, and so we must shrink from being fully alive.
http://www.stealth-x.com

Edited by stealth- on 09-10-09 02:09
http://www.stealth-x.com
Author

RE: C++ compiling issue, Mac/codeblocks/GCC

kenneth_nap
Member

Posts: 62
Location: United States
Joined: 06.12.08
Rank:
God
Posted on 09-10-09 02:18
Be sure you don't have a ; after #define commands, and check to ensure you don't have () after class names.

Example:

Correct:
#include <iostream>
#include iostream.h

class Bogus
{
}

Incorrect:
#include <iostream>;
#include iostream.h;

class Bogus()
{
}






Forum Posts + Points

Guest - 0
Newbie - 20
Apprentice - 200
Moderate - 350
Wiseman - 500
Active User - 700
Mad User - 950
Monster - 1200
Hacker Level 1 - 1500
Hacker Level 2 - 1700
Hacker Level 3 - 1900
Elite - 2100
Uber Elite - 2450
HBH Guru - 2700
God - 3500


Edited by kenneth_nap on 09-10-09 02:21
kenneth_napaluch
Author

RE: C++ compiling issue, Mac/codeblocks/GCC

Apophis
Member

Posts: 86
Location:
Joined: 02.10.09
Rank:
Moderate
Posted on 09-10-09 02:29
Is this the first time you've compiled something with gcc/g++ on that machine?

Try commenting out the entire body of your code and just leave the main function and the include and see if it still has a problem.




Edited by Apophis on 09-10-09 02:31
Author

RE: C++ compiling issue, Mac/codeblocks/GCC

Recursacro
Member



Posts: 33
Location: ~
Joined: 08.10.09
Rank:
Moderate
Posted on 09-10-09 02:48
Without seeing the code, I am having a hard time deciding. Here's my advice:

Change the order in which you #include files
--They need to be in a certain order, and if they aren't right, things go bad

And/or:

Did the program work before the linked list? Is it singly or doubly linked?
If the program worked before it, and the list messed it up, I recommend using std::vector instead. It's much easier to use than a list, and I'll help you with the syntax if you'd like.

For now, until you post some code, or I think of another thing. Try those.


"Your worst enemy cannot harm you as much as your own unguarded thoughts." - The Buddha
"In fact, everything we encounter in this world with our six senses is an inkblot test. You see what you are thinking and feeling, seldom what you are looking at." - Shiqin
Author

RE: C++ compiling issue, Mac/codeblocks/GCC

ynori7
Future Emperor of Earth



Posts: 1481
Location: #valhalla
Joined: 08.10.07
Rank:
Diabolical
Posted on 09-10-09 03:12
Recursacro wrote:
Change the order in which you #include files
--They need to be in a certain order, and if they aren't right, things go bad

I've never really noticed that problem. Unless you're including user-defined header files that rely on the main program to provide the necessary includes, that's probably not your problem.

Like mentioned earlier, the easiest way to figure out what your problem is is to determine where it occurs, start by commenting everything out, and then gradually uncommenting pieces until it breaks again.




ynori7 http://halls-of-valhalla.org
Author

RE: C++ compiling issue, Mac/codeblocks/GCC

Recursacro
Member



Posts: 33
Location: ~
Joined: 08.10.09
Rank:
Moderate
Posted on 09-10-09 03:16
ynori7 wrote:
Recursacro wrote:
Change the order in which you #include files
--They need to be in a certain order, and if they aren't right, things go bad

I've never really noticed that problem. Unless you're including user-defined header files that rely on the main program to provide the necessary includes, that's probably not your problem.

Like mentioned earlier, the easiest way to figure out what your problem is is to determine where it occurs, start by commenting everything out, and then gradually uncommenting pieces until it breaks again.


Yeah. Notice stdio's signature, stating stdio.h is always on top.
You're absolutely right about the commenting. He just needs to find out what the problem it. Perhaps even start a new project and add the code to it bit by bit. It seems to me that the code was transferred from one comp to another, because it wasn't clearly stated when the program occurred. I wonder if it was written on Mac...


"Your worst enemy cannot harm you as much as your own unguarded thoughts." - The Buddha
"In fact, everything we encounter in this world with our six senses is an inkblot test. You see what you are thinking and feeling, seldom what you are looking at." - Shiqin
Author

RE: C++ compiling issue, Mac/codeblocks/GCC

Zkunxen
Member

Posts: 47
Location:
Joined: 24.07.09
Rank:
Elite
Posted on 09-10-09 20:06
it was written on mac (typed up and attempted to compile on same machine), and after adding the linked list (singly linked list) it stopped working.
the linked list was typed up on my iPod touch, then emailed, and I copied and pasted the code, but more than half my other programs are the same story and they all work, and no, I've compiled on this machine before.
I'll try the commenting thing. Also, could the fact that some of the headers were included in 3 of the files? (2 headers, and main.cpp)
I'm most confused by the error in time.h
unless that's included by default with stdio.h, I know I'm not including it.
EDIT:
fixed it, I had a curly bracket where there should have been a semicolon.
now on to the other 50 bugs, after fixing the five I had...

Edited by Zkunxen on 09-10-09 20:48
Author

RE: C++ compiling issue, Mac/codeblocks/GCC

Recursacro
Member



Posts: 33
Location: ~
Joined: 08.10.09
Rank:
Moderate
Posted on 09-10-09 21:32
You fixed which one? And what ones do you have left?

I stand by what I said:

std::vector is way more maintainable than a list.


"Your worst enemy cannot harm you as much as your own unguarded thoughts." - The Buddha
"In fact, everything we encounter in this world with our six senses is an inkblot test. You see what you are thinking and feeling, seldom what you are looking at." - Shiqin
Author

RE: C++ compiling issue, Mac/codeblocks/GCC

Zkunxen
Member

Posts: 47
Location:
Joined: 24.07.09
Rank:
Elite
Posted on 09-10-09 21:50
I replaced the stray curly bracket with a semicolon, and all those errors disappeared, and I only had 4 more errors (oops, used . instead of -> 4 times), and then 30 more errors, defined a member function with different parameters than in member class, missing semicolons, misspelled variable names, the usual easy fixes.
now I'm just having a linker issue.
I know vectors are more maintainable, but I spent almost 8 hours writing my own linked list class, I want to use it. My linked list class can return an array containing all the values in the order they appear in the list, and can convert an array to a linked list (I think, I haven't gotten to test it yet, but it looks like it would work...)
Author

RE: C++ compiling issue, Mac/codeblocks/GCC

Recursacro
Member



Posts: 33
Location: ~
Joined: 08.10.09
Rank:
Moderate
Posted on 10-10-09 03:12
Linker issues are good, in your case. It means that you've nothing wrong with your actual code.

I completely understand your sentimental feelings toward the list class. I'd feel the same way. It sounds as though you've made it pretty efficient!

To solve linker errors, check your Linker settings in the project manager. I'm assuming you're using VS. If not, just check to make sure the compiler knows what libraries to use. It's not all done with just #includes. :-)

Best wishes.


"Your worst enemy cannot harm you as much as your own unguarded thoughts." - The Buddha
"In fact, everything we encounter in this world with our six senses is an inkblot test. You see what you are thinking and feeling, seldom what you are looking at." - Shiqin
Guest
Username

Password

Remember Me


Bookmark This Page
Affiliates
Adverts

 

 

Links
By using, viewing or obtaining any information contained on this site, you agree to the disclaimer.

© HellBound Hackers 2008- 2009. Since 3rd December 2004.