namespace std and LLVM PassManagerInternal.h file - c++

I'm exploring compiler writing with Flex, Bison and LLVM (latest versions of all) using this example: http://gnuu.org/2009/09/18/writing-your-own-toy-compiler/
Github source is on the last page of that link. I can't get it to compile and any help would be appreciated.
Unfortunately for me, the solution is non-obvious.
Here are the errors:
In file included from codegen.cpp:2:
In file included from ./codegen.h:8:
In file included from /usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManager.h:46:
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManagerInternal.h:298:12: error: use of undeclared identifier 'make_unique'
return make_unique<ResultModelT>(Pass.run(IR, AM));
^
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManagerInternal.h:298:24: error: unexpected type name 'ResultModelT': expected expression
return make_unique<ResultModelT>(Pass.run(IR, AM));
^
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManagerInternal.h:336:12: error: use of undeclared identifier 'make_unique'
return make_unique<ResultModelT>(Pass.run(IR));
^
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManagerInternal.h:336:24: error: unexpected type name 'ResultModelT': expected expression
return make_unique<ResultModelT>(Pass.run(IR));
^
codegen.cpp:36:24: error: no matching conversion for functional-style cast from 'unique_ptr<llvm::Module>' to 'llvm::EngineBuilder'
ExecutionEngine *ee = EngineBuilder( unique_ptr<Module>(module) ).create();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/anaconda/include/llvm/ExecutionEngine/ExecutionEngine.h:493:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion
from 'unique_ptr<llvm::Module>' to 'llvm::EngineBuilder' for 1st argument
class EngineBuilder {
^
/anaconda/include/llvm/ExecutionEngine/ExecutionEngine.h:493:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion
from 'unique_ptr<llvm::Module>' to 'const llvm::EngineBuilder' for 1st argument
/anaconda/include/llvm/ExecutionEngine/ExecutionEngine.h:525:3: note: candidate constructor not viable: no known conversion from 'unique_ptr<llvm::Module>'
to 'llvm::Module *' for 1st argument
EngineBuilder(Module *m) : M(m) {
^
codegen.cpp:131:49: warning: expression with side effects will be evaluated despite being used as an operand to 'typeid'
[-Wpotentially-evaluated-expression]
std::cout << "Generating code for " << typeid(**it).name() << endl;
^
In file included from codegen.cpp:2:
In file included from ./codegen.h:8:
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManager.h:207:22: error: no member named 'getName' in 'llvm::Module'
<< IR.getName() << "\n";
~~ ^
codegen.cpp:30:5: note: in instantiation of member function 'llvm::PassManager<llvm::Module>::run' requested here
pm.run(*module);
^
In file included from codegen.cpp:2:
In file included from ./codegen.h:8:
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManager.h:517:20: error: no member named 'getName' in 'llvm::Module'
<< IR.getName() << "\n";
~~ ^
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManager.h:372:28: note: in instantiation of member function
'llvm::AnalysisManager<llvm::Module>::invalidateImpl' requested here
return derived_this()->invalidateImpl(IR, std::move(PA));
^
/usr/local/Cellar/llvm/3.8.1/include/llvm/IR/PassManager.h:217:22: note: in instantiation of member function
'llvm::detail::AnalysisManagerBase<llvm::AnalysisManager<llvm::Module>, llvm::Module>::invalidate' requested here
PassPA = AM->invalidate(IR, std::move(PassPA));
^
codegen.cpp:30:5: note: in instantiation of member function 'llvm::PassManager<llvm::Module>::run' requested here
pm.run(*module);
^

Well, there is llvm::make_unique in include/llvm/ADT/STLExtras.h. You have not stated if you are writing your own code based on llvm source or compiling llvm or what but I assume llvm::make_unique is there exactly for that reason to fill the missing pieces of C++11.
Moreover, looking at the tutorials it seems that llvm::make_unique is explicitly used everywhere.
Update
So I successfully build the given example against LLVM 3.9.0 from svn. I had to change and fix all the calls to getGlobalContext() since that is gone in LLVM 3.9.0, but I did not encounter any make_unique related issues. However the example itself is a bit broken. codegen.h is missing an include guard, codegen.cpp is missing an include to #include "llvm/IR/LLVMContext.h", even if it wants to use the old getGlobalContext() method. I did this on Windows with MSVC 2015, can you specify your environment and compiler so that I can try the same?

Related

HLS4ML generates ambiguous overloaded operator '<<'

I am trying to implement an MLP using HLS4ML following the tutorial https://github.com/Gabriele-bot/PYNQ_IA/blob/main/NN_train/MNIST_Test/MNIST_CNN_train.ipynb
The command to synthesize the generated C files
hls_model.build(csim=False,synth=True,export=True)
produces the error
error: use of overloaded operator '<<' is ambiguous (with operand
types 'basic_ostream<char, std::char_traits >' and 'const T_in'
(aka 'const ap_fixed<8, 3>'))
I have tried synthesizing the design using Vivado HLS 2018.3 and 2020.1. But both produces similar error. Has anybody experienced and resolved such errors with HLS4ML generated codes?
The failed synthesis report shows a long list of candidates, such as the following:
ERROR: [HLS 200-70] Compilation errors found: In file included from
firmware/myproject_axi.cpp:1: In file included from
firmware/myproject_axi.cpp:1: firmware/myproject_axi.h:17:35: error:
use of overloaded operator '<<' is ambiguous (with operand types
'basic_ostream<char, std::char_traits >' and 'const T_in' (aka
'const ap_fixed<8, 2>'))
{ return stream << "{ data: " << in.data << ", last: " << in.last << " }" << std::endl; }
~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~
/tools/Xilinx/Vivado/2020.1/lnx64/tools/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../include/c++/4.6.3/ostream:166:7:
note: candidate function
operator<<(long __n)
^
/tools/Xilinx/Vivado/2020.1/lnx64/tools/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../include/c++/4.6.3/ostream:170:7:
note: candidate function
operator<<(unsigned long __n)
^ /tools/Xilinx/Vivado/2020.1/lnx64/tools/gcc/lib/gcc/x86_64-unknown-linux-gnu/4.6.3/../../../../include/c++/4.6.3/ostream:174:7:
note: candidate function
operator<<(bool __n)
I am also attaching a screen capture of the myproject_axi.h file which is creating the issue.

How to format "if" statement in C++ macro (& how to use Arduino's new EEPROM library get & put functions)

Update 3 Jan. 2016: I have answered my own question now too.
I need some help formatting my "if" statement in this C++ macro please:
#define updateEEPROMVal(address,val) if (EEPROM.get(address)!=val) \
EEPROM.put(address,val)
I'm getting pages of errors, so I'm assuming it's a simple formatting problem.
Update Apr. 2020: Jump straight to my answer. My macro was fine (surrounding it with do {} while (false) would have been better of course, but it was fine as-is). I was simply forgetting the 2nd parameter in EEPROM.get() is all. The 2nd parameter is passed by NON-const C++ reference, and at the time I didn't really know what a reference was or how it worked, so I didn't use the .get() method correctly. That's it!
Back to my original question from 2016:
Here's the full context:
//----------------------------------------------------------------------------------------------------------------------------------
//storeXYValsIntoEEPROM
//-store the current global variable x and y low, center, and high values into EEPROM
//----------------------------------------------------------------------------------------------------------------------------------
#define updateEEPROMVal(address,val) if (EEPROM.get(address)!=val) \
EEPROM.put(address,val)
void storeXYValsIntoEEPROM()
{
//update EEPROM values *only* if necessary, this way you minimize writes (and wear-and-tear) on the EEPROM, since it is limited to
//100k writes per cell I believe (see datasheet)
updateEEPROMVal(0,x_low);
updateEEPROMVal(2,x_ctr);
updateEEPROMVal(4,x_high);
updateEEPROMVal(6,y_low);
updateEEPROMVal(8,y_ctr);
updateEEPROMVal(10,y_high);
}
UPDATE: HERE's my error output:
Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Uno"
Using library IRremote in folder: C:\Gabe\Gabe - RC-extra\Arduino\Sketches\libraries\IRremote (legacy)
Using library eRCaGuy_ButtonReader in folder: C:\Gabe\Gabe - RC-extra\Arduino\Sketches\libraries\eRCaGuy_ButtonReader (legacy)
Using library EEPROM in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard -IC:\Gabe\Gabe - RC-extra\Arduino\Sketches\libraries\IRremote -IC:\Gabe\Gabe - RC-extra\Arduino\Sketches\libraries\eRCaGuy_ButtonReader -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM C:\Users\Gabriel\AppData\Local\Temp\build6111239347405487460.tmp\IR_Tx_code5_w_calibration_mode.cpp -o C:\Users\Gabriel\AppData\Local\Temp\build6111239347405487460.tmp\IR_Tx_code5_w_calibration_mode.cpp.o
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:43:30: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
operator const uint8_t() const { return **this; }
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:92:26: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
operator const int() const { return index; }
^
IR_Tx_code5_w_calibration_mode.ino: In function 'void storeXYValsIntoEEPROM()':
IR_Tx_code5_w_calibration_mode.ino:430:61: error: no matching function for call to 'EEPROMClass::get(int)'
IR_Tx_code5_w_calibration_mode.ino:436:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate is:
IR_Tx_code5_w_calibration_mode.ino:436:3: note: in expansion of macro 'updateEEPROMVal'
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template<class T> T& EEPROMClass::get(int, T&)
template< typename T > T &get( int idx, T &t ){
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template argument deduction/substitution failed:
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate expects 2 arguments, 1 provided
IR_Tx_code5_w_calibration_mode.ino:436:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: error: no matching function for call to 'EEPROMClass::get(int)'
IR_Tx_code5_w_calibration_mode.ino:437:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate is:
IR_Tx_code5_w_calibration_mode.ino:437:3: note: in expansion of macro 'updateEEPROMVal'
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template<class T> T& EEPROMClass::get(int, T&)
template< typename T > T &get( int idx, T &t ){
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template argument deduction/substitution failed:
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate expects 2 arguments, 1 provided
IR_Tx_code5_w_calibration_mode.ino:437:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: error: no matching function for call to 'EEPROMClass::get(int)'
IR_Tx_code5_w_calibration_mode.ino:438:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate is:
IR_Tx_code5_w_calibration_mode.ino:438:3: note: in expansion of macro 'updateEEPROMVal'
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template<class T> T& EEPROMClass::get(int, T&)
template< typename T > T &get( int idx, T &t ){
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template argument deduction/substitution failed:
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate expects 2 arguments, 1 provided
IR_Tx_code5_w_calibration_mode.ino:438:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: error: no matching function for call to 'EEPROMClass::get(int)'
IR_Tx_code5_w_calibration_mode.ino:439:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate is:
IR_Tx_code5_w_calibration_mode.ino:439:3: note: in expansion of macro 'updateEEPROMVal'
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template<class T> T& EEPROMClass::get(int, T&)
template< typename T > T &get( int idx, T &t ){
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template argument deduction/substitution failed:
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate expects 2 arguments, 1 provided
IR_Tx_code5_w_calibration_mode.ino:439:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: error: no matching function for call to 'EEPROMClass::get(int)'
IR_Tx_code5_w_calibration_mode.ino:440:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate is:
IR_Tx_code5_w_calibration_mode.ino:440:3: note: in expansion of macro 'updateEEPROMVal'
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template<class T> T& EEPROMClass::get(int, T&)
template< typename T > T &get( int idx, T &t ){
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template argument deduction/substitution failed:
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate expects 2 arguments, 1 provided
IR_Tx_code5_w_calibration_mode.ino:440:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: error: no matching function for call to 'EEPROMClass::get(int)'
IR_Tx_code5_w_calibration_mode.ino:441:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate is:
IR_Tx_code5_w_calibration_mode.ino:441:3: note: in expansion of macro 'updateEEPROMVal'
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template<class T> T& EEPROMClass::get(int, T&)
template< typename T > T &get( int idx, T &t ){
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template argument deduction/substitution failed:
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate expects 2 arguments, 1 provided
IR_Tx_code5_w_calibration_mode.ino:441:3: note: in expansion of macro 'updateEEPROMVal'
Multiple libraries were found for "IRremote.h"
Used: C:\Gabe\Gabe - RC-extra\Arduino\Sketches\libraries\IRremote
Not used: C:\Program Files (x86)\Arduino\libraries\RobotIRremote
no matching function for call to 'EEPROMClass::get(int)'
Code with do{...}while(0) your macro (and don't forget the semicolon):
#define updateEEPROMVal(address,val) do{if (EEPROM.get(address)!=val) \
EEPROM.put(address,val);}while(0)
See also this
Better yet, make that a static inline function (to be put in some header file).
Also, use g++ -C -E source.cc > source.ii to get the preprocessed form, you can look inside it.
There is no need for this. When I wrote the library I made sure it minimizes the wear & tear.
The EEPROM function put() uses the update method on the byte level.
You are simply duplicating functionality.
If you have more questions regarding the EEPROM lib, ask on the forum.
I created a thread just for my library: https://forum.arduino.cc/index.php?topic=312645
My Answer:
Sorry for the trouble, it turns out I was misusing the EEPROM.get function, and the problem wasn't my macro at all. The EEPROM library get() method is defined: https://github.com/arduino/ArduinoCore-avr/blob/master/libraries/EEPROM/src/EEPROM.h#L130, and the documentation here: https://www.arduino.cc/en/Reference/EEPROMGet.
I was simply missing the 2nd argument, accidentally using this:
EEPROM.get(address);
...instead of this:
any_type val_in_EEPROM;
EEPROM.get(address, val_in_EEPROM);
Here are 2 solutions I came up with that work.
1) Using a separate function:
-I prefer this method. It turns out the word "inline" in this case is optional, and makes no difference.
-This method makes my program 7610 bytes, with 472 bytes used for global variables. It takes 162 bytes less memory than option 2 below.
inline void updateEEPROMVal(uint16_t address, uint16_t val)
{
uint16_t val_in_EEPROM;
EEPROM.get(address,val_in_EEPROM);
if (val_in_EEPROM!=val)
EEPROM.put(address,val);
}
void storeGlobalXYValsIntoEEPROM()
{
updateEEPROMVal(0,x_low);
updateEEPROMVal(2,x_ctr);
updateEEPROMVal(4,x_high);
updateEEPROMVal(6,y_low);
updateEEPROMVal(8,y_ctr);
updateEEPROMVal(10,y_high);
}
2) Using a macro, as follows:
-I prefer the above method.
-This method takes 7772 bytes for program space, and 472 bytes for global variables. It takes 162 bytes more than the above method.
uint16_t val_in_EEPROM;
#define updateEEPROMVal(address,val) EEPROM.get(address,val_in_EEPROM); \
if (val_in_EEPROM!=val) \
EEPROM.put(address,val)
void storeGlobalXYValsIntoEEPROM()
{
uint16_t val_in_EEPROM;
updateEEPROMVal(0,x_low);
updateEEPROMVal(2,x_ctr);
updateEEPROMVal(4,x_high);
updateEEPROMVal(6,y_low);
updateEEPROMVal(8,y_ctr);
updateEEPROMVal(10,y_high);
}
Thanks for everyone's help!
3) (Updated answer) EEPROM.put(address,val) already does the functionality I'm trying to achieve above to avoid unnecessary wear on the EEPROM, so just use the .put() function by itself, as-is!
See #Chris A's answer here.
Yet again I have failed to fully read the documentation. The EEPROM library Put function documentation here (https://github.com/arduino/Arduino/tree/master/hardware/arduino/avr/libraries/EEPROM) says, "This function uses the update method to write its data, and therefore only rewrites changed cells." Therefore, my update code is redundant. I just need to use the "put" function as-is. Refer to the EEPROM library's author's (Chris A) answer here too.
So, I've learned a lot, and here's my final answer:
Get rid of my support function and macro, and just use the put function as-is. It already minimizes EEPROM wear and only writes if the contents are different. Nevertheless, I'll leave my above answers for completeness' sake for those who are looking for what the macro or function solution otherwise would have been.

Compiling C++ Thrift code to interface Cassandra results in following errors. What are we missing here?

$ g++ -lthrift -Wall thriftfs.cpp cassandra_constants.cpp Cassandra.cpp cassandra_types.cpp -o thriftfs -I/usr/local/include/thrift -L/usr/local/lib
In file included from /usr/local/include/thrift/protocol/TProtocol.h:23:0,
from /usr/local/include/thrift/TProcessor.h:24,
from Cassandra.h:10,
from t`enter code here`hriftfs.cpp:4:
/usr/local/include/thrift/transport/TTransport.h:34:1: error: ‘uint32_t’ does not name a type
/usr/local/include/thrift/transport/TTransport.h:156:29: error: ISO C++ forbids declaration of ‘buf’ with no type [-fpermissive]
In file included from /usr/local/include/thrift/TProcessor.h:24:0,
from Cassandra.h:10,
from thriftfs.cpp:4:
/usr/local/include/thrift/protocol/TProtocol.h:184:1: error: ‘uint32_t’ does not name a type
In file included from Cassandra.h:10:0,
from thriftfs.cpp:4:
/usr/local/include/thrift/TProcessor.h:72:57: error: ‘uint32_t’ has not been declared
In file included from cassandra_types.h:11:0,
from Cassandra.h:11,
from thriftfs.cpp:4:
/usr/local/include/thrift/TApplicationException.h:94:3: error: ‘uint32_t’ does not name a type
In file included from Cassandra.h:11:0,
from thriftfs.cpp:4:
cassandra_types.h:85:16: error: ‘uint8_t’ does not name a type
In file included from Cassandra.h:11:0,
from thriftfs.cpp:4:
cassandra_types.h:142:3: error: ‘uint32_t’ does not name a type
In file included from Cassandra.h:11:0,
from thriftfs.cpp:4:
cassandra_types.h:1478:16: error: ‘uint8_t’ does not name a type
In file included from Cassandra.h:11:0,
from thriftfs.cpp:4:
cassandra_types.h:1812:3: error: ‘uint32_t’ does not name a type
In file included from thriftfs.cpp:4:0:
Cassandra.h:217:3: error: ‘uint32_t’ does not name a type
Cassandra.h:4857:35: error: ‘org::apache::thrift’ has not been declared
Cassandra.h:4857:62: error: expected ‘,’ or ‘...’ before ‘*’ token
Cassandra.h:4859:71: error: cannot declare pointer to ‘void’ member
Cassandra.h:4859:145: error: template argument 2 is invalid
Cassandra.h:4859:145: error: template argument 4 is invalid
Cassandra.h:4860:45: error: ‘org::apache::thrift’ has not been declared
Cassandra.h:4860:72: error: expected ‘,’ or ‘...’ before ‘*’ token
Cassandra.h:4935:42: error: ‘thrift’ is not a member of ‘org::apache’
Cassandra.h:4935:42: note: suggested alternative:
/usr/local/include/thrift/Thrift.h:75:37: note: ‘apache::thrift’
Cassandra.h:4935:42: error: ‘thrift’ is not a member of ‘org::apache’
Cassandra.h:4935:42: note: suggested alternative:
/usr/local/include/thrift/Thrift.h:75:37: note: ‘apache::thrift’
Cassandra.h:4935:77: error: template argument 1 is invalid
Cassandra.h:4935:105: error: ‘thrift’ is not a member of ‘org::apache’
Cassandra.h:4935:105: note: suggested alternative:
/usr/local/include/thrift/Thrift.h:75:37: note: ‘apache::thrift’
Cassandra.h:4935:105: error: ‘thrift’ is not a member of ‘org::apache’
Cassandra.h:4935:105: note: suggested alternative:
/usr/local/include/thrift/Thrift.h:75:37: note: ‘apache::thrift’
Cassandra.h:4935:140: error: template argument 1 is invalid
Cassandra.h: In constructor ‘org::apache::cassandra::CassandraProcessor::CassandraProcessor(boost::shared_ptr)’:
Cassandra.h:4898:49: error: assignment of read-only location ‘"login"[((org::apache::cassandra::CassandraProcessor*)this)->org::apache::cassandra::CassandraProcessor::processMap_]’
Cassandra.h:4898:49: error: cannot convert ‘void (org::apache::cassandra::CassandraProcessor::*)(int32_t, int) {aka void (org::apach
Add the following defines:
g++ -DHAVE_NETINET_IN_H -DHAVE_INTTYPES_H ...
Or add #include <stdint.h> before including Thrift.h in your code.
See the discussion at THRIFT-1326. The issue is suppposedly fixed in thrift 0.9.
It looks like your problem is a compiler issue.
It can't find the type "uint32_t"
There is another question on SO regarding this:
'uint32_t' identifier not found error
Quoted from user templatetypedef
This type is defined in the C header which is not currently
a part of the C++ standard. According to the Wikipedia page on the
header, it hasn't shipped with Visual Studio until VS2010.
In the meantime, you could probably fake up your own version of the
header by adding typedefs that map Microsoft's custom integer types to
the types expected by C. For example:
typedef __int32 int32_t; typedef unsigned __int32 uint32_t; /* ...
etc. ... */ Hope this helps!

.cpp error: no match for 'operator<' in 'std::cerr < "Converting file \""'

I'm trying to execute this code nmea2kml.cpp
but I keep getting the following errors. Also the program has command line parameters -f path Read file at given path (e.g. /some/where/nmea.txt) What should I change to run the program? Am I getting the error due to a compiler problem? coz I've messed up with adding cygwin, MinGW compilers to eclipse!! I know the program is correct. Others have used it and got the results.(http://julien.cayzac.name/code/gps/)
Error
g++ -O0 -g3 -Wall -c -fmessage-length=0 -osrc\nmea.o ..\src\nmea.cpp
..\src\nmea.cpp: In function `int main(int, char**)':
..\src\nmea.cpp:195: error: no match for 'operator<' in 'std::cerr < "Converting file \""'
..\src\nmea.cpp:195: note: candidates are: operator<(const char*, const char*) <built-in>
..\src\nmea.cpp:195: note: operator<(void*, void*) <built-in>
..\src\nmea.cpp:336: error: no match for 'operator<' in 'std::cout < "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"'
..\src\nmea.cpp:336: note: candidates are: operator<(const char*, const char*) <built-in>
..\src\nmea.cpp:336: note: operator<(void*, void*) <built-in>
..\src\nmea.cpp:336: error: `std::endl(std::basic_ostream<_CharT, _Traits>&)' cannot appear in a constant-expression
..\src\nmea.cpp:355: error: parse error in template argument list
..\src\nmea.cpp:336: error: `endl<<expression error> >' cannot appear in a constant-expression
..\src\nmea.cpp:406: error: parse error in template argument list
..\src\nmea.cpp:336: error: `endl<<expression error> >' cannot appear in a constant-expression
..\src\nmea.cpp:406: error: parse error in template argument list
..\src\nmea.cpp:336: error: `endl<<expression error> >' cannot appear in a constant-expression
..\src\nmea.cpp:406: error: parse error in template argument list
..\src\nmea.cpp:406: error: expected `;' before '}' token
..\src\nmea.cpp:193: warning: unused variable 'outfile'
Build error occurred, build is stopped
It looks like you have written std::cerr < "..." (the < operator) where you meant to write std::cerr << "..." (the << operator).
Try using the bit-shift "<<" instead of the less-than "<" operator with your ostreams:
std::cerr << "Converting file \"";
No, the code as shown is not correct. You perform output with std::cout << ..., not std::cout < .... Probably some HTML conversion messed it up.

How to compile C++ program with using html tidy C++

I installed tidy-dev from ubuntu repository, checked installation path - it's okay (/usr/include/tidy).
But I can not find a true flags to compile my c++ script with include tidy c++ wrapper tidyx.h from http://users.rcn.com/creitzel/tidy/tidyx.h
Can you help me?
My test script file named 1.cpp, tidyx.h I put near. 1.cpp content:
#include "tidyx.h"
int main()
{
}
I try it, but no-good:
$ gcc -I/usr/include/tidy 1.cpp -ltidy
In file included from 1.cpp:1:
tidyx.h: In constructor ‘Tidy::Source::Source()’:
tidyx.h:83: error: invalid conversion from ‘int (*)(ulong)’ to ‘int (*)(void*)’
tidyx.h:84: error: invalid conversion from ‘void (*)(ulong, byte)’ to ‘void (*)(void*, byte)’
tidyx.h:85: error: invalid conversion from ‘Bool (*)(ulong)’ to ‘Bool (*)(void*)’
tidyx.h:86: error: invalid conversion from ‘ulong’ to ‘void*’
tidyx.h: In constructor ‘Tidy::Sink::Sink()’:
tidyx.h:123: error: invalid conversion from ‘void (*)(ulong, byte)’ to ‘void (*)(void*, byte)’
tidyx.h:124: error: invalid conversion from ‘ulong’ to ‘void*’
tidyx.h: In member function ‘void Tidy::Buffer::Attach(void*, uint)’:
tidyx.h:165: error: invalid conversion from ‘void*’ to ‘byte*’
tidyx.h:165: error: initializing argument 2 of ‘void tidyBufAttach(TidyBuffer*, byte*, uint)’
tidyx.h: In member function ‘int Tidy::Document::Create()’:
tidyx.h:496: error: invalid conversion from ‘ulong’ to ‘void*’
tidyx.h:496: error: initializing argument 2 of ‘void tidySetAppData(const _TidyDoc*, void*)’
tidyx.h: In member function ‘void Tidy::Document::SetAppData(ulong)’:
tidyx.h:511: error: invalid conversion from ‘ulong’ to ‘void*’
tidyx.h:511: error: initializing argument 2 of ‘void tidySetAppData(const _TidyDoc*, void*)’
tidyx.h: In member function ‘ulong Tidy::Document::GetAppData()’:
tidyx.h:512: error: invalid conversion from ‘void*’ to ‘ulong’
To include a header file you need to use the #include preprocessor directive. It will look for the header file in compiler include paths.
If tidyx.h is in /usr/include/tidy you could put in your source file:
#include <tidy/tidyx.h>
and then compile just with gcc script.cpp, since /usr/include is most likely a default include path for your compiler.
Otherwise you could also put in your source file:
#include <tidyx.h>
And then tell GCC to look in /usr/include/tidy: gcc -I/usr/include/tidy script.cpp
At this point the header will be found. If you'll get other errors related to tidy (eg: some tidy functions are not defined) you'll need to link your binary to some library using GCC -l option.
EDIT after OP's massive edit.
Your problem here is that tidyx.h contains C++ code, and also your source file, looking to its extensions, seems to be a C++ source file. You'll need a C++ compiler in order to compile it. Use g++ instead of gcc:
g++ script.cpp