2012-10-02 16 views
9

मैं अपने मैक पर बढ़ावा देना चाहता हूं।बूस्ट संकलन त्रुटि मैक ओएस एक्स 10.7.4

मैक ओएस एक्स 10.7.4 Xcode 4.5

मैं homebrew द्वारा बढ़ावा स्थापित।

brew install boost 

बूस्ट संस्करण 1.4 9.0 है। और मैंने अपना एक्सकोड प्रोजेक्ट स्थापित किया।

शीर्षलेख खोज पथ जोड़ें।

/usr/local/Cellar/boost/1.49.0/include 

जोड़े पुस्तकालयों

libboost * .dylib 

जब मैं अपने प्रोजेक्ट को संकलित, मैं कई त्रुटियाँ हैं। क्लैंग एलएलवीएम 1.0 त्रुटि। (मैं एक छवि अपलोड करना चाहते हैं, लेकिन मैं अपलोड नहीं कर सकते becase मैं 10 से अधिक प्रतिष्ठा नहीं है।)

use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'? 
use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'? 
too few template arguments for class template '__is_function' 
use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'? 
field has incomplete type 'std::exception_ptr' 
expected ';' at end of declaration list 
no member named 'memcpy' in namespace 'std::__1'; did you mean 'memcpy'? 
no member named 'memcpy' in namespace 'std::__1'; did you mean 'memcpy'? 
expected ';' at end of declaration list 
expected ';' at end of declaration list 
C++ requires a type specifier for all declarations 
'operator==' cannot be the name of a variable or data member 
use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'? 
expected ';' at end of declaration 
expected unqualified-id 
expected ';' at end of declaration list 
unknown type name 'nullptr_t' 
unknown type name 'nullptr_t' 
qualified reference to 'shared_ptr' is a constructor name rather than a type wherever a constructor can be declared 
too many errors emitted, stopping now 

मैं इस सवाल की जाँच की।

XCode with boost "Semantic Issue - undeclared identifier va_start"

लेकिन मैं उत्तर नहीं मिल सके। यदि कोई समाधान है तो कृपया मुझे बताएं।

बूस्ट का उपयोग कर हेडर फ़ाइल इस तरह है। !

GLTexture.hpp

#pragma once 

#ifndef __GL_TEXTURE_HPP__ 
#define __GL_TEXTURE_HPP__ 

// Standard libraries. 
#include <iostream> 
#include <fstream> 
#include <string> 

#ifdef _WIN32 
#pragma warning (push) 
#pragma warning (disable:4819) 
#endif 

// Smart pointers. 
#include <boost/shared_ptr.hpp> 
#include <boost/scoped_ptr.hpp> 
#include <boost/shared_array.hpp> 

// Foreach macros. 
#include <boost/foreach.hpp> 

// Regular expression. 
#include <boost/regex.hpp> 

// Image I/O. 
#define png_infopp_NULL (png_infopp)NULL 
#define int_p_NULL (int*)NULL 
#include <boost/gil/gil_all.hpp> 
#include <boost/gil/extension/io/jpeg_io.hpp> 
#include <boost/gil/extension/io/png_io.hpp> 

// File operations, 
#include <boost/filesystem.hpp> 

// Linear algebra, 
#include <boost/numeric/ublas/vector.hpp> 
#include <boost/numeric/ublas/matrix.hpp> 
#include <boost/numeric/ublas/io.hpp> 

// String functions. 
#include <boost/algorithm/string.hpp> 

// Serialization 
#include <boost/serialization/serialization.hpp> 
#include <boost/serialization/string.hpp> 
#include <boost/serialization/vector.hpp> 
#include <boost/archive/xml_iarchive.hpp> 
#include <boost/archive/xml_oarchive.hpp> 
#include <boost/serialization/version.hpp> 

#ifdef _WIN32 
#pragma warning (pop) 
#endif 

// OpenGL and OpenGL Utility Toolkit 
#ifdef _WIN32 

#include <GL/glew.h> 
#include <GL/GLUT.h> 

#elif defined __APPLE__ 

#include <OpenGL/OpenGL.h> 
#include <GLUT/GLUT.h> 


#endif 

#include "TextureManager.hpp" 
#include <time.h> 

class TextureManager; 

using namespace std; 


/// function to convert RGB image to RGBA image. 
/// Filling its alpha channel with 255. 
/// This function is called from boost::gil::copy_and_convert_pixels() 
namespace boost { 
    namespace gil { 
     template <> void color_convert<rgb8_pixel_t,rgba8_pixel_t>(const rgb8_pixel_t& src,rgba8_pixel_t& dst); 
    } 
} 


class GLTexture 
{ 
public: 

    //Destructor 
    ~GLTexture(); 

    //Return instance of GLTexture 
    static boost::shared_ptr<GLTexture> getInstance(const std::string& filename, bool _isVolatile = true); 

    //Load image file and generate texture 
    bool LoadFromFile(boost::shared_ptr<GLTexture> texture); 

    //Bind texture when the texture exists. If the texture doesn't exist, this method generates a texture. 
    static void bindTexture(boost::shared_ptr<GLTexture> texture); 

    //Setter of texFileName 
    void setTextureFile(const std::string filename); 
    //Setter of volatile Flag 
    void setIsVolatile(bool _isVolatile); 

    //Getter of texture ID 
    inline const GLuint& getTextureID(void)const{ 
     return this->texture; 
    }; 

    //Overload of operator to sort list 
    friend bool operator <(const boost::shared_ptr<GLTexture>& texture1, const boost::shared_ptr<GLTexture>& texture2); 
    friend std::ostream& operator <<(ostream& os, const boost::shared_ptr<GLTexture>& texture); 




public: 
    GLuint texture;    //texture id 
    std::string texFileName; //image file path 
    int width;     //width of image 
    int height;     //height of image 
    clock_t start, end;   //start is the timing of bindTexture, end is the timing of delete, these are used to sort list. 
    bool isVolatile;   //the flag whether this texture is volatile or not. true is volatile, and false is not volatile. To keep texture, this is false. 
    bool isRead;    //the flag whether this texture already exists in texturelist. true means "exists", false means "not exists". 

    boost::shared_ptr<boost::gil::rgba8_image_t> pixelData_ptr;      //smart pointer to contain pixelData 
    boost::shared_ptr<boost::gil::rgba8_image_t::const_view_t> viewwithAlpha_ptr; //smart pointer to contain viewData 




private: 
    //Forbid copy constructor 
    GLTexture(); 
    GLTexture(const std::string& imageFilePath, bool _isVolatile = false); 
    GLTexture(const GLTexture& glTexture); 
    GLTexture& operator = (const GLTexture& glTexture); 

    //load image from SSD 
    bool LoadImage(const std::string& filename); 




}; 

#endif 

TextureManager.hpp

#pragma once 

#ifndef __TEXTURE_MANAGER_HPP__ 
#define __TEXTURE_MANAGER_HPP__ 

// Standard libraries. 
#include <iostream> 
#include <fstream> 
#include <string> 

#ifdef _WIN32 
#pragma warning (push) 
#pragma warning (disable:4819) 
#endif 

// Smart pointers. 
#include <boost/shared_ptr.hpp> 

#include <boost/shared_array.hpp> 

// Foreach macros. 
#include <boost/foreach.hpp> 

// Regular expression. 
#include <boost/regex.hpp> 

// Image I/O. 
#define png_infopp_NULL (png_infopp)NULL 
#define int_p_NULL (int*)NULL 
#include <boost/gil/gil_all.hpp> 
#include <boost/gil/extension/io/jpeg_io.hpp> 
#include <boost/gil/extension/io/png_io.hpp> 

// File operations, 
#include <boost/filesystem.hpp> 

// Linear algebra, 
#include <boost/numeric/ublas/vector.hpp> 
#include <boost/numeric/ublas/matrix.hpp> 
#include <boost/numeric/ublas/io.hpp> 

// String functions. 
#include <boost/algorithm/string.hpp> 

// Serialization 
#include <boost/serialization/serialization.hpp> 
#include <boost/serialization/string.hpp> 
#include <boost/serialization/vector.hpp> 
#include <boost/archive/xml_iarchive.hpp> 
#include <boost/archive/xml_oarchive.hpp> 
#include <boost/serialization/version.hpp> 

#ifdef _WIN32 
#pragma warning (pop) 
#endif 

// OpenGL and OpenGL Utility Toolkit 
#ifdef _WIN32 

#include <GL/glew.h> 
#include <GL/GLUT.h> 

#elif defined __APPLE__ 

#include <OpenGL/OpenGL.h> 
#include <GLUT/GLUT.h> 


#endif 

#include "GLTexture.hpp" 


class GLTexture; 

class TextureManager 
{ 
public: 
    TextureManager(void); 
    ~TextureManager(void); 

    //Generate Texture 
    static void genTexture(boost::shared_ptr<GLTexture> texture); 


    static void setTexture(const boost::shared_ptr<GLTexture> texture); 

    static void deleteTexture(); 
    static bool checkList(const std::string& filename); 


private: 

    //Forbid copy constructor 
    TextureManager(const TextureManager& texManager); 
    TextureManager& operator = (const TextureManager& texManager); 

}; 

#endif 
+0

आप LLVM जीसीसी के लिए एप्पल LLVM से अपने संकलक बदलने के लिए करने की कोशिश की जरूरत है? – Ninten

+0

क्या आप प्रासंगिक कोड दिखा सकते हैं जो त्रुटियों का उत्पादन करता है? –

+0

@Ninten मैंने संकलक को जीसीसी एलएलवीएम में बदलने की कोशिश की, लेकिन मुझे एक ही त्रुटि थी। – micchyboy

उत्तर

3

मैं था similary समस्या मैं इस समस्या soved कि: Xcode-> Buid सेटिंग> C++ भाषा बोली (जीएनयू ++ 11) -> सी ++ मानक लाइब्रेरी (libC++ (सी ++ 11 के साथ एलएलवीएम सी ++)

+1

मुझे एक्सकोड 7.2 पर एक ही समस्या है लेकिन आपके (और अन्य संयोजन भी) से मेल खाने के लिए सी ++ भाषा सेटिंग्स को बदलना त्रुटियों को रोकता नहीं है। – Dai

+0

@ दाई क्या आपने इसे हल किया है? –

+0

@MichaelIV नहीं, क्षमा करें। मैंने हार मान लिया। – Dai

7

क्या आपने हेडर के लिए रिकर्सिव खोज पथ का उपयोग किया था? यदि ऐसा है तो इसे गैर-पुनरावर्ती में बदलें। इससे समस्या हल हो सकती है।