Find the answer to your Linux question:
Results 1 to 2 of 2
I'm trying to get the mimetic Email library (MIME) to work with a simple C++ executable. I've followed the INSTALL instructions and everything went smoothly. I've tried the following twice, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2013
    Posts
    3

    mimetic doesn't compile with a simple executable on centOS


    I'm trying to get the mimetic Email library (MIME) to work with a simple C++ executable. I've followed the INSTALL instructions and everything went smoothly. I've tried the following twice,
    on a CentOS 6.4, gcc version : 4.4.7
    and on a CentOS 5.7, gcc version : 4.1.2

    when I try to compile the following .cpp file :

    Code:
    #include <iostream>
    #include <mimetic/mimetic.h>
    
    using namespace std;
    using namespace mimetic;
    
    int main()
    {
    ios_base::sync_with_stdio(false);        // optimization
    istreambuf_iterator<char> bit(cin), eit; // get stdin iterators
    MimeEntity me(bit,eit);                       // parse and load 
    return 0;
    }
    (I took an example from the mimetic site and made it even more basic)
    I've compiled simply with:
    Code:
    g++ *.cpp
    CentOS 6.4, gcc version : 4.4.7 trial
    gives this error:

    Code:
    In file included from /usr/local/include/mimetic/rfc822/header.h:18,
                     from /usr/local/include/mimetic/header.h:11,
                     from /usr/local/include/mimetic/mimetic.h:18,
                     from mimetic.cpp:3:
    /usr/local/include/mimetic/rfc822/messageid.h:29: error: expected ‘)’ before ‘thread_id’
    this is the /usr/local/include/mimetic/rfc822/messageid.h file :

    Code:
    #ifndef _MIMETIC_MESSAGEID_H_
    #define _MIMETIC_MESSAGEID_H_
    #ifdef HAVE_STDINT_H
    #include <stdint.h>
    #endif
    #include <string>
    #include <mimetic/libconfig.h>
    #ifdef HAVE_INTTYPES_H
    #include <inttypes.h>
    #endif
    #include <mimetic/utils.h>
    #include <mimetic/os/utils.h>
    #include <mimetic/rfc822/fieldvalue.h>
    namespace mimetic
    {
    
    /// Message-ID field value 
    struct MessageId: public FieldValue
    {
        MessageId(uint32_t thread_id = 0 ); // <------------- line 29
        MessageId(const std::string&);
        std::string str() const;
        void set(const std::string&);
    protected:
        FieldValue* clone() const;
    private:
        static unsigned int ms_sequence_number;
        std::string m_msgid;
    };
    
    }
    #endif
    CentOS 5.7, gcc version : 4.1.2 trial
    gives this error:

    Code:
    /tmp/ccodM1Mn.o: In function `main':
    mimetic.cpp:(.text+0xcb): undefined reference to `mimetic::MimeEntity::~MimeEntity()'
    /tmp/ccodM1Mn.o: In function `mimetic::IteratorParser<std::istreambuf_iterator<char, std::char_traits<char> >, std::input_iterator_tag>::appendPreambleBlock(char const*, int)':
    mimetic.cpp:(.text._ZN7mimetic14IteratorParserISt19istreambuf_iteratorIcSt11char_traitsIcEESt18input_iterator_tagE19appendPreambleBlockEPKci[mimetic::IteratorParser<std::istreambuf_iterator<char, std::char_traits<char> >, std::input_iterator_tag>::appendPreambleBlock(char const*, int)]+0x33): undefined reference to `mimetic::MimeEntity::body()'
    mimetic.cpp:(.text._ZN7mimetic14IteratorParserISt19istreambuf_iteratorIcSt11char_traitsIcEESt18input_iterator_tagE19appendPreambleBlockEPKci[mimetic::IteratorParser<std::istreambuf_iterator<char, std::char_traits<char> >, std::input_iterator_tag>::appendPreambleBlock(char const*, int)]+0x3b): undefined reference to `mimetic::Body::preamble()'
    /tmp/ccodM1Mn.o: In function `mimetic::IteratorParser<std::istreambuf_iterator<char, std::char_traits<char> >, std::input_iterator_tag>::appendBodyBlock(char const*, int)':
    mimetic.cpp:(.text._ZN7mimetic14IteratorParserISt19istreambuf_iteratorIcSt11char_traitsIcEESt18input_iterator_tagE15appendBodyBlockEPKci[mimetic::IteratorParser<std::istreambuf_iterator<char, std::char_traits<char> >, std::input_iterator_tag>::appendBodyBlock(char const*, int)]+0x33): undefined reference to `mimetic::MimeEntity::body()'
    /tmp/ccodM1Mn.o: In function `mimetic::IteratorParser<std::istreambuf_iterator<char, std::char_traits<char> >, std::input_iterator_tag>::appendEpilogueBlock(char const*, int)':
    mimetic.cpp:(.text._ZN7mimetic14IteratorParserISt19istreambuf_iteratorIcSt11char_traitsIcEESt18input_iterator_tagE19appendEpilogueBlockEPKci[mimetic::IteratorParser<std::istreambuf_iterator<char, std::char_traits<char> >, std::input_iterator_tag>::appendEpilogueBlock(char const*, int)]+0x33): undefined reference to `mimetic::MimeEntity::body()'
    mimetic.cpp:(.text._ZN7mimetic14IteratorParserISt19istreambuf_iteratorIcSt11char_traitsIcEESt18input_iterator_tagE19appendEpilogueBlockEPKci[mimetic::IteratorParser<std::istreambuf_iterator<char, std::char_traits<char> >, std::input_iterator_tag>::appendEpilogueBlock(char const*, int)]+0x3b): undefined reference to `mimetic::Body::epilogue()'
    /tmp/ccodM1Mn.o: In function `void std::_Destroy<mimetic::Field>(mimetic::Field*)':
    mimetic.cpp:(.text._ZSt8_DestroyIN7mimetic5FieldEEvPT_[void std::_Destroy<mimetic::Field>(mimetic::Field*)]+0x11): undefined reference to `mimetic::Field::~Field()'
    /tmp/ccodM1Mn.o: In function `__gnu_cxx::new_allocator<mimetic::Field>::construct(mimetic::Field*, mimetic::Field const&)':
    mimetic.cpp:(.text._ZN9__gnu_cxx13new_allocatorIN7mimetic5FieldEE9constructEPS2_RKS2_[__gnu_cxx::new_allocator<mimetic::Field>::construct(mimetic::Field*, mimetic::Field const&)]+0x37): undefined reference to `mimetic::Field::Field(mimetic::Field const&)'
    /tmp/ccodM1Mn.o: In function `std::deque<mimetic::Field, std::allocator<mimetic::Field> >::_M_push_front_aux(mimetic::Field const&)':
    mimetic.cpp:(.text._ZNSt5dequeIN7mimetic5FieldESaIS1_EE17_M_push_front_auxERKS1_[std::deque<mimetic::Field, std::allocator<mimetic::Field> >::_M_push_front_aux(mimetic::Field const&)]+0x1a): undefined reference to `mimetic::Field::Field(mimetic::Field const&)'
    mimetic.cpp:(.text._ZNSt5dequeIN7mimetic5FieldESaIS1_EE17_M_push_front_auxERKS1_[std::deque<mimetic::Field, std::allocator<mimetic::Field> >::_M_push_front_aux(mimetic::Field const&)]+0x96): undefined reference to `mimetic::Field::~Field()'
    //.
    //.
    //. it's pretty long...
    mimetic.cpp:(.text._ZN7mimetic10MimeEntityC1ISt19istreambuf_iteratorIcSt11char_traitsIcEEEET_S6_i[mimetic::MimeEntity::MimeEntity<std::istreambuf_iterator<char, std::char_traits<char> > >(std::istreambuf_iterator<char, std::char_traits<char> >, std::istreambuf_iterator<char, std::char_traits<char> >, int)]+0x2e): undefined reference to `vtable for mimetic::MimeEntity'
    mimetic.cpp:(.text._ZN7mimetic10MimeEntityC1ISt19istreambuf_iteratorIcSt11char_traitsIcEEEET_S6_i[mimetic::MimeEntity::MimeEntity<std::istreambuf_iterator<char, std::char_traits<char> > >(std::istreambuf_iterator<char, std::char_traits<char> >, std::istreambuf_iterator<char, std::char_traits<char> >, int)]+0x4f): undefined reference to `mimetic::Body::Body()'
    mimetic.cpp:(.text._ZN7mimetic10MimeEntityC1ISt19istreambuf_iteratorIcSt11char_traitsIcEEEET_S6_i[mimetic::MimeEntity::MimeEntity<std::istreambuf_iterator<char, std::char_traits<char> > >(std::istreambuf_iterator<char, std::char_traits<char> >, std::istreambuf_iterator<char, std::char_traits<char> >, int)]+0x58): undefined reference to `mimetic::MimeEntity::commonInit()'
    collect2: ld returned 1 exit status
    Any thoughts ? Thanks

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,665
    In 6.4 you have a compiler error - you probably didn't configure the build for the tool correctly. In 5.7 you are getting linkage errors which makes sense. You need to build a proper Makefile so the appropriate header and library locations/names are provided to the compiler and linker. You generally cannot just use g++ to build an executable. Study the compiler options with the g++ and gcc man pages to start with. Building packages like this from source code is generally not for the newbie...
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •