can not cast ConstantInt in llvm - llvm

Following code:
ConstantInt * Idx = cast<ConstantInt>(gepi->getOperand(2));
generates following error:
error: invalid use of incomplete type ‘struct llvm::ConstantInt’
error: forward declaration of ‘struct llvm::ConstantInt’
I don't know why this cast won't work. I am using llvm 3.1. Any help?

Add #include <Constants.h> to your source.

Related

SendInviteResult - invalid use of incomplete type 'class firebase::Future<firebase::invites::InvitesSender::SendInviteResult>'

On C++, how to send an invite?
firebase::invites::InvitesSender *sender = new firebase::invites::InvitesSender(*_app);
sender->SetTitleText("Invite Friends");
sender->SetMessageText("Try my app today, and get 200 free coins!");
sender->SetCallToActionText("Download now!");
sender->SendInvite();
the compiler gives the error:
error: invalid use of incomplete type 'class firebase::Future<firebase::invites::InvitesSender::SendInviteResult>'
sender->SendInvite();
firebase_cpp_sdk\include/firebase/invites/sender.h:12:7: error: declaration of 'class firebase::Future<firebase::invites::InvitesSender::SendInviteResult>'
class Future;
Found it! It needs the include:
#include <firebase/future.h>

Using CLAHE algorithm

I am trying to use the source code provided here for CLAHE algorithm.
When I include the "ClaheImageFilter.h" in my code and compile it, it gives me the following errors:
> In file included from /myDir/myCode.cxx:25:
> /myDir/ClaheImageFilter.h: In member function ‘void
ClaheImageFilter<T_ItkImage>::_execute(typename T_ItkImage::Pointer)’:
> /myDir/ClaheImageFilter.h:1270: error: expected initializer
before ‘&’ token
> /myDir/ClaheImageFilter.h:1271: error:
‘roLargestSize’ was not declared in this scope
> /myDir/ClaheImageFilter.h: In member function ‘void
ClaheImageFilter<T_ItkImage>::_fromFlatArrayToItk(typename
T_ItkImage::PixelType*, const typename T_ItkImage::SizeType&, unsigned
int)’:
> /myDir/ClaheImageFilter.h:1498: error: expected ‘;’
before ‘start’ /myDir/ClaheImageFilter.h:1499: error: ‘start’
was not declared in this scope
Does anyone know what is causing the problem?
line 25 in myCode.cxx is just #include "ClaheImageFilter.h".

Gobby 0.4.12 install error

I ran across the following error when attempting to install Gobby 0.4.12 from source on Ubuntu 13.10. Any ideas?
I'm fairly confident it's a version error, but I'm curious if anyone else has run across this same problem and found a fix.
src/gselector.cpp: In member function ‘void Gobby::GSelector::add_socket(const net6::socket&, net6::io_condition)’:
src/gselector.cpp:87:17: error: ‘signal_io’ is not a member of ‘Glib’
sel.io_conn = Glib::signal_io().connect(
^
src/gselector.cpp: In member function ‘void Gobby::GSelector::modify_socket(std::map<const net6::socket*, Gobby::GSelector::SelectedSocket>::iterator, net6::io_condition)’:
src/gselector.cpp:109:27: error: ‘signal_io’ is not a member of ‘Glib’
iter->second.io_conn = Glib::signal_io().connect(
^
src/gselector.cpp: In member function ‘void Gobby::GSelector::set_timeout(const net6::socket&, long unsigned int)’:
src/gselector.cpp:226:24: error: ‘signal_timeout’ is not a member of ‘Glib’
sel_sock->time_conn = Glib::signal_timeout().connect(
This A Known Bug And It Has Been Fixed In sobby - 0.4.8-1
Check Here:
https://bugs.launchpad.net/ubuntu/+source/sobby/+bug/935447

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!

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