You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Blackbox Dev Team (JIRA)" <ji...@apache.org> on 2013/08/30 10:59:51 UTC

[jira] [Updated] (THRIFT-2154) Missing
     [ https://issues.apache.org/jira/browse/THRIFT-2154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Blackbox Dev Team updated THRIFT-2154:
--------------------------------------

    Description: 
When I compile:
{code:title=d.thrift}
struct Ala {
	1: optional i32 a
}

struct Basia {
	1: optional map<Ala, i32> b
}
{code}

{code:title=main.cpp}
#include <iostream>
#include "gen-cpp/d_types.h"

int main() {
    Basia b;

    return 0;
}
{code}

{code:title=makefile}
GEN_SRC := main.cpp\
gen-cpp/d_constants.cpp \
gen-cpp/d_types.cpp \

GEN_OBJ := $(patsubst %.cpp,%.o, $(GEN_SRC))

THRIFT_DIR := /usr/local/include/thrift
BOOST_DIR := /usr/local/include

INC := -I$(THRIFT_DIR) -I$(BOOST_DIR)

.PHONY: all clean

all:  main

%.o: %.cpp 
	$(CXX) --std=c++11 -Wall -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H $(INC) -c $< -o $@

main: main.o $(GEN_OBJ)
	$(CXX) $^ -o $@ -L/usr/local/lib -lthrift

clean:
	$(RM) *.o gen-cpp/*.o main
{code}
I get an error:
{code}
g++ main.o gen-cpp/d_constants.o gen-cpp/d_types.o -o main -L/usr/local/lib -lthrift
gen-cpp/d_types.o: In function `std::less<Ala>::operator()(Ala const&, Ala const&) const':
d_types.cpp:(.text._ZNKSt4lessI3AlaEclERKS0_S3_[_ZNKSt4lessI3AlaEclERKS0_S3_]+0x14): undefined reference to `Ala::operator<(Ala const&) const'
collect2: error: ld returned 1 exit status
{code}

  was:
When I compile:
{code:title=d.thrift}
struct Ala {
	1: optional i32 a
}

struct Basia {
	1: optional map<Ala, i32> b
}
{code}

{code:title=main.cpp}
#include <iostream>

#include "gen-cpp/d_types.h"
int main() {
    Basia b;

    return 0;
}
{code}

{code:title=makefile}
GEN_SRC := main.cpp\
gen-cpp/d_constants.cpp \
gen-cpp/d_types.cpp \

GEN_OBJ := $(patsubst %.cpp,%.o, $(GEN_SRC))

THRIFT_DIR := /usr/local/include/thrift
BOOST_DIR := /usr/local/include

INC := -I$(THRIFT_DIR) -I$(BOOST_DIR)

.PHONY: all clean

all:  main

%.o: %.cpp 
	$(CXX) --std=c++11 -Wall -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H $(INC) -c $< -o $@

main: main.o $(GEN_OBJ)
	$(CXX) $^ -o $@ -L/usr/local/lib -lthrift

clean:
	$(RM) *.o gen-cpp/*.o main
{code}
I get an error:
{code}
g++ main.o gen-cpp/d_constants.o gen-cpp/d_types.o -o main -L/usr/local/lib -lthrift
gen-cpp/d_types.o: In function `std::less<Ala>::operator()(Ala const&, Ala const&) const':
d_types.cpp:(.text._ZNKSt4lessI3AlaEclERKS0_S3_[_ZNKSt4lessI3AlaEclERKS0_S3_]+0x14): undefined reference to `Ala::operator<(Ala const&) const'
collect2: error: ld returned 1 exit status
{code}

    
> Missing <operator body
> ----------------------
>
>                 Key: THRIFT-2154
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2154
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Compiler
>    Affects Versions: 0.9
>         Environment: Fedora 19
> g++ (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1)
>            Reporter: Blackbox Dev Team
>
> When I compile:
> {code:title=d.thrift}
> struct Ala {
> 	1: optional i32 a
> }
> struct Basia {
> 	1: optional map<Ala, i32> b
> }
> {code}
> {code:title=main.cpp}
> #include <iostream>
> #include "gen-cpp/d_types.h"
> int main() {
>     Basia b;
>     return 0;
> }
> {code}
> {code:title=makefile}
> GEN_SRC := main.cpp\
> gen-cpp/d_constants.cpp \
> gen-cpp/d_types.cpp \
> GEN_OBJ := $(patsubst %.cpp,%.o, $(GEN_SRC))
> THRIFT_DIR := /usr/local/include/thrift
> BOOST_DIR := /usr/local/include
> INC := -I$(THRIFT_DIR) -I$(BOOST_DIR)
> .PHONY: all clean
> all:  main
> %.o: %.cpp 
> 	$(CXX) --std=c++11 -Wall -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H $(INC) -c $< -o $@
> main: main.o $(GEN_OBJ)
> 	$(CXX) $^ -o $@ -L/usr/local/lib -lthrift
> clean:
> 	$(RM) *.o gen-cpp/*.o main
> {code}
> I get an error:
> {code}
> g++ main.o gen-cpp/d_constants.o gen-cpp/d_types.o -o main -L/usr/local/lib -lthrift
> gen-cpp/d_types.o: In function `std::less<Ala>::operator()(Ala const&, Ala const&) const':
> d_types.cpp:(.text._ZNKSt4lessI3AlaEclERKS0_S3_[_ZNKSt4lessI3AlaEclERKS0_S3_]+0x14): undefined reference to `Ala::operator<(Ala const&) const'
> collect2: error: ld returned 1 exit status
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira