Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
mkhexgrid [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Black
Tux's lil' helper
Tux's lil' helper


Joined: 10 Dec 2002
Posts: 124
Location: Province of Quebec, Canada

PostPosted: Sun Feb 21, 2010 4:59 am    Post subject: mkhexgrid [SOLVED] Reply with quote

Hi everyone!

I'd like to use the software mkhexgrid. It's not in Portage, so I downloaded the source code from the web site. It's a small application, so I figured it wouldn't be complicated. The site says it requires boost and GD, both of which are installed.

My problem is that when I try to compile (using the command 'make'), I get the following:

Code:
g++  -c -g -O2 -W -Wall -DVERSION='"0.1.1"'  -c -o mkhexgrid.o mkhexgrid.cpp
mkhexgrid.cpp: In function ‘void parse_spec(std::istream&, std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&)’:
mkhexgrid.cpp:203: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘for’ statement
mkhexgrid.cpp:221: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘for’ statement
g++  -c -g -O2 -W -Wall -DVERSION='"0.1.1"'  -c -o grid.o grid.cpp
grid.cpp: In member function ‘void Grid::parse_length(const char*, const std::string&, double&)’:
grid.cpp:643: error: ‘strcmp’ was not declared in this scope
make: *** [grid.o] Error 1


My knowledge of C / C++ is lacking, and I thought 'strcmp' was a built-in C command. Anyone has a hint for me?

Thanks!


Last edited by Black on Wed Mar 03, 2010 1:29 pm; edited 1 time in total
Back to top
View user's profile Send private message
Mad Merlin
Veteran
Veteran


Joined: 09 May 2005
Posts: 1155

PostPosted: Wed Mar 03, 2010 1:35 am    Post subject: Reply with quote

The software probably was never tested with newer versions of gcc, 4.3 (IIRC) cleaned up a lot of includes which caused a lot of software to stop compiling until they fixed their includes.

Basically, that file doesn't explicitly #include <string.h>, and older versions of gcc included it implicitly as a dependency of other includes, but the newer version doesn't, so what accidentally worked before no longer does.

Either fix the includes yourself (requires slightly greater than zero programming skill), or try compiling with an older version of gcc (4.1 or 3.4 is a good bet).
_________________
Game! - Where the stick is mightier than the sword!
Back to top
View user's profile Send private message
Black
Tux's lil' helper
Tux's lil' helper


Joined: 10 Dec 2002
Posts: 124
Location: Province of Quebec, Canada

PostPosted: Wed Mar 03, 2010 1:29 pm    Post subject: Reply with quote

Well, that fixed it, thanks!

#include <string> was there, and I thought it was the same thing as #include <string.h>, but apparently it's not (at least, not for a recent GCC).
Back to top
View user's profile Send private message
SamuliSuominen
Retired Dev
Retired Dev


Joined: 30 Sep 2005
Posts: 2133
Location: Finland

PostPosted: Wed Mar 03, 2010 1:57 pm    Post subject: Reply with quote

mkhexgrid-0.1.1.ebuild:

Code:
# Copyright 1999-2010 Gentoo Foundation                                                                     
# Distributed under the terms of the GNU General Public License v2                                           
# $Header: $                                                                                                 

EAPI=2
inherit eutils toolchain-funcs

DESCRIPTION="A fully-configurable hex grid generator"
HOMEPAGE="http://www.nomic.net/~uckelman/mkhexgrid/"
SRC_URI="http://www.nomic.net/~uckelman/${PN}/releases/${P}.src.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

RDEPEND="media-libs/gd"
DEPEND="${RDEPEND}
        dev-libs/boost"

src_prepare() {
        epatch "${FILESDIR}"/${P}-Makefile.patch \
                "${FILESDIR}"/${P}-gcc44.patch
}

src_compile() {
        tc-export CXX
        emake || die
}

src_install() {
        dobin ${PN} || die

        doman doc/*.1
        dohtml doc/*.html

        dodoc AUTHORS HISTORY README TODO
}


mkhexgrid-0.1.1-Makefile.patch:

Code:
--- Makefile.orig       2007-01-10 15:37:42.000000000 +0200
+++ Makefile    2010-03-03 15:51:44.000000000 +0200
@@ -8,9 +8,10 @@
 DISTDIR=mkhexgrid-$(VERSION)
 RPMDIR=/home/uckelman/rpmbuild

-CC=g++
-CPPFLAGS=-c -g -O2 -W -Wall -DVERSION='"$(VERSION)"'
-LDFLAGS=-lm -lstdc++ -lgd
+CXX ?= g++
+CPPFLAGS += -DVERSION='"$(VERSION)"'
+CXXFLAGS += -W -Wall
+LIBS = -lm -lstdc++ -lgd

 FILES=grid.h \
       grid.cpp \


mkhexgrid-0.1.1-gcc44.patch:

Code:
--- png.cpp.orig        2010-03-03 15:58:53.000000000 +0200
+++ png.cpp     2010-03-03 15:59:44.000000000 +0200
@@ -19,6 +19,7 @@

 #include <cmath>
 #include <cstdlib>
+#include <cstring>
 #include <iostream>
 #include <iomanip>
 #include <exception>


But it's still failing for me,

mkhexgrid.cpp: In function ‘int main(int, char**)’:
mkhexgrid.cpp:151: error: reference to ‘exception’ is ambiguous
/usr/include/boost/exception/exception.hpp:177: error: candidates are: class boost::exception
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4/exception:60: error: class std::exception
mkhexgrid.cpp:151: error: expected type-specifier before ‘exception’
mkhexgrid.cpp:151: error: expected ‘)’ before ‘&’ token
mkhexgrid.cpp:151: error: expected ‘{’ before ‘&’ token
mkhexgrid.cpp:151: error: ‘e’ was not declared in this scope
mkhexgrid.cpp:151: error: expected ‘;’ before ‘)’ token
Back to top
View user's profile Send private message
SamuliSuominen
Retired Dev
Retired Dev


Joined: 30 Sep 2005
Posts: 2133
Location: Finland

PostPosted: Wed Mar 03, 2010 1:59 pm    Post subject: Reply with quote

Oh, and I don't expect any reply to above. I was just bored and wrote that in like minute or two... Figured I'd share it here, before deleting it from my hdd.

8)
Back to top
View user's profile Send private message
Mad Merlin
Veteran
Veteran


Joined: 09 May 2005
Posts: 1155

PostPosted: Thu Mar 04, 2010 12:14 am    Post subject: Reply with quote

Black wrote:
Well, that fixed it, thanks!

#include <string> was there, and I thought it was the same thing as #include <string.h>, but apparently it's not (at least, not for a recent GCC).


They're not, <string> is the C++ string library, <string.h> (or <cstring>) is the C string library.
_________________
Game! - Where the stick is mightier than the sword!
Back to top
View user's profile Send private message
Black
Tux's lil' helper
Tux's lil' helper


Joined: 10 Dec 2002
Posts: 124
Location: Province of Quebec, Canada

PostPosted: Thu Mar 04, 2010 4:13 am    Post subject: Reply with quote

Ah, thanks for the explanation!

Like we say here: je vais me coucher moins niaiseux ce soir! (I'll get to bed less stupid tonight!)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum