K
K
KOS_MOS2011-11-02 12:24:29
C++ / C#
KOS_MOS, 2011-11-02 12:24:29

C++ - invalid initialization of reference of type

I'm building php_llvm under Ubuntu 11.10, when I do make I get an error on the cpp source.

When I do make it outputs:
In file included from /usr/include/php5/Zend/zend.h:758:0,
from /usr/include/php5/main/php.h:34,
from /home/pavel/pecl_llvm/php-llvm/preprocess_module_template.cpp:36:
/usr/include/php5/Zend/zend_operators.h: In function ?zend_uchar is_numeric_string(const char*, int, long int*, double*, int):
/usr/include/php5/Zend/zend_operators.h:170:49: warning: cast from type ?const char** to type ?char** casts away qualifiers [-Wcast-qual]
/usr/include/php5/Zend/zend_operators.h:181:44: warning: cast from type ?const char** to type ?char** casts away qualifiers [-Wcast-qual]
/home/pavel/pecl_llvm/php-llvm/preprocess_module_template.cpp: In function ?int main(int, char**):
/home/pavel/pecl_llvm/php-llvm/preprocess_module_template.cpp:59:40: error: invalid initialization of non-const reference of type ?llvm::LLVMContext& from an rvalue of type ?std::string* {aka std::basic_string*}
/usr/lib/llvm-2.8/include/llvm/Bitcode/ReaderWriter.h:39:11: error: in passing argument 2 of ?llvm::Module* llvm::ParseBitcodeFile(llvm::MemoryBuffer*, llvm::LLVMContext&, std::string*)
/home/pavel/pecl_llvm/php-llvm/preprocess_module_template.cpp:126:31: error: invalid initialization of reference of type ?llvm::raw_ostream& from expression of type ?std::ofstream {aka std::basic_ofstream}
/usr/lib/llvm-2.8/include/llvm/Bitcode/ReaderWriter.h:45:8: error: in passing argument 2 of ?void llvm::WriteBitcodeToFile(const llvm::Module*, llvm::raw_ostream&)
make: *** [preprocess_module_template] Error 1

кусок кода из preprocess_module_template.cpp:
// Write out the module
verifyModule(*mod, AbortProcessAction);

std::ofstream bc_os(compile_file, std::ios_base::out | std::ios_base::binary | std::ios_base::trunc);
if (bc_os.fail()) {
fprintf(stderr, "failed opening %s for writing the bitcode\n", compile_file);
return 1;
}

WriteBitcodeToFile(mod, bc_os);

126 строка - последняя

Как можно исправить.
В С++ ноль - поэтому затрудняюсь сам.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question