G++ compile errors

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

G++ compile errors

Postby wiz » Wed Jun 28, 2006 10:46 pm

I am trying to compile some code and I keep getting errors that look like compiler or library version problems.

Code: Select all
from imgstream.cc:31:
/usr/include/c++/3.4/cstddef:52: error: expected unqualified-id before "long"
/usr/include/c++/3.4/cstddef:52: error: expected `;' before "long"
In file included from /usr/include/c++/3.4/bits/stl_algobase.h:67,
                 from /usr/include/c++/3.4/bits/char_traits.h:46,
                 from /usr/include/c++/3.4/ios:46,
                 from /usr/include/c++/3.4/ostream:45,
                 from /usr/include/c++/3.4/iostream:45,
                 from imgstream.hh:40,
                 from imgstream.cc:31:
/usr/include/c++/3.4/cstdlib:103: error: `::malloc' has not been declared
/usr/include/c++/3.4/cstdlib:111: error: `::realloc' has not been declared


Can anybody give me a clue to what may be wrong?
The same problem occurs with g++ 3.3, 3.4 & 4.0
wiz
LXF regular
 
Posts: 119
Joined: Thu Apr 07, 2005 6:20 pm
Location: In front of a computer

RE: G++ compile errors

Postby Nigel » Wed Jun 28, 2006 10:59 pm

What is line 52 of cstddef ?
Also, what are the lines just before line 40 of imgstream.hh and line 31 of imgstream.cc ?
User avatar
Nigel
LXF regular
 
Posts: 1141
Joined: Fri Apr 08, 2005 8:03 pm
Location: Gloucestershire, UK

RE: G++ compile errors

Postby jjmac » Wed Jun 28, 2006 11:49 pm

/usr/include/c++/3.4/cstddef

Code: Select all
#ifndef _GLIBCXX_CSTDDEF
#define _GLIBCXX_CSTDDEF 1

#pragma GCC system_header

#include <stddef.h>

namespace std
{
  using ::ptrdiff_t;   <-------------- line 52.
  using ::size_t;
}


stdlib.h is included by 'cstdlib' ??

Maybe you just need to add "using namespace std" , without the quotes up the top of the file yur trying to pass.


jm
http://counter.li.org
#313537

The FVWM wm -=- www.fvwm.org -=-

Somebody stole my air guitar, It happened just the other day,
But it's ok, 'cause i've got a spare ...
jjmac
LXF regular
 
Posts: 1996
Joined: Fri Apr 08, 2005 1:32 am
Location: Sydney, Australia

Postby wiz » Thu Jun 29, 2006 6:28 am

The code I am trying to compile was written by Epson for a scanner driver so I am certain that the syntax is correct, I have not changed it at all.

The compiler is finding errors in the C++ library code from #include statements in the Epson code

I will post a few more details later. I'm off to work :(
wiz
LXF regular
 
Posts: 119
Joined: Thu Apr 07, 2005 6:20 pm
Location: In front of a computer

Postby wiz » Thu Jun 29, 2006 7:57 pm

Found a whole load of gobbledegook about it at http://tinyurl.com/ndw32

It looks as though it just needs a bit more experimenting to figure out what is going on.


edit: The bit about compiling from source is down at the bottom of the page
wiz
LXF regular
 
Posts: 119
Joined: Thu Apr 07, 2005 6:20 pm
Location: In front of a computer

Postby jjmac » Mon Jul 03, 2006 9:12 am

>>
The code I am trying to compile was written by Epson for a scanner driver so I am certain that the syntax is correct, I have not changed it at all.
>>

Thats very trusting of you :).

Unless "using namespce std;" is decleared at the top of a src file, any following types that are scoped/wrapped by that namespace will be unknown to the compiler. As "unknown" type messages were being generated, especially for something like ::malloc, i figured it would be worth checking on.

>>
The compiler is finding errors in the C++ library code from #include statements in the Epson code
>>

Just looking at that link briefly, and the nature of the patches, the errors are more likely being generated by the epson src. And yes, there is an abi change between 3.3.x and 3.4.x which probably is the root of the fails.



jm
http://counter.li.org
#313537

The FVWM wm -=- www.fvwm.org -=-

Somebody stole my air guitar, It happened just the other day,
But it's ok, 'cause i've got a spare ...
jjmac
LXF regular
 
Posts: 1996
Joined: Fri Apr 08, 2005 1:32 am
Location: Sydney, Australia

Postby wiz » Mon Jul 03, 2006 12:58 pm

Thanks. This was part of a rushed job so I couldn't afford to spend too much time on it.
I got the scanner working by using Xsane with a driver from the Windoze software disk, but Xsane takes almost 40! seconds to start.
I will get back to it when I have more time, I want to know what is wrong for future reference.
wiz
LXF regular
 
Posts: 119
Joined: Thu Apr 07, 2005 6:20 pm
Location: In front of a computer


Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests

cron