I am trying to write an LLVM backend, when I am trying to build it, I get the following error message:
AbcGenRegisterInfo.inc: In static member function 'static const llvm::AbcFrameLowering* llvm::AbcGenRegisterInfo::getFrameLowering(const llvm::MachineFunction&)':
AbcGenRegisterInfo.inc:322:43: error: invalid static_cast from type 'const llvm::TargetFrameLowering*' to type 'const llvm::AbcFrameLowering*'
MF.getSubtarget().getFrameLowering());
^
Here is my AbcRegisterInfo.td (I copied it from here):
class AbcReg<string n> : Register<n> {
let namespace = "Abc";
}
def DUMMY_REG : AbcReg<"R0">;
def RegI64 : RegisterClass<"Abc", [i64], 64, (add DUMMY_REG)>;
I also overrided AbcSubtarget::getFrameLowering() method:
class AbcSubTarget : public AbcGenSubtargetInfo {
AbcFrameLowering *frameLowering;
// more fields and methods
const AbcFrameLowering *getFrameLowering() const override {
return frameLowering;
}
};
but the error message did not change.
I don't understand what to do - I can't just edit AbcGenRegisterInfo.inc, because it will be re-generated every time I will build LLVM, and I don't understand what's wrong in my TableGen files.
I also tried to remove AbcGenRegisterInfo.inc file from my build directory before compiling, but it had no effect.
Does AbcFrameLowering inherit from TargetFrameLowering? It looks like the static cast is complaining because the types are unrelated.
Also make sure the header with the definition of AbcFrameLowering is included before the .inc file is included otherwise the static cast will fail as well.
I have the same exact error, and while I cannot answer your question in full, I believe I can address one part of the issue. You said
I also tried to remove AbcGenRegisterInfo.inc file from my build directory before compiling, but it had no effect.
Unless you mean that AbcGenRegisterInfo.inc was regenerated (and therefore deleting it had no effect), the fact that its absence has no effect should be due to the fact that TableGen has the .inc.tmp file to rely on as a backup. I noticed that when I make with VERBOSE=1, there is a statement that suggests tablegen uses the .tmp files in this way.
Again, not a specific answer to your main question, but just to hopefully help address that issue when trying to debug.
Related
I am defining a new interface and a class that implements it. I have added my class(XXX) and interface(IXXX) in idl file (I generated two uuids). My interface has two simple methods. I have implemented them( files XXX.h and XXX.cpp). I included the following line in InprocServer.cpp.
UNKNOWN_OBJECT(XXX)
I am getting the following error:
Error C2259 'XXX': cannot instantiate abstract class (compiling source file InprocServer.cpp)
clicking on error takes me to the following line in
Unknown.h
try
{
**p = new T(pUnkOuter); // refcount is already 1**
if (!p)
return E_OUTOFMEMORY;
}
How do I know which method is not implemented?
Look in the output window (View->Output)rather than the error list and any unimplemented members will be part of the diagnostic.
This works so long as you have the setting in Tools->Options, Projects and Solutions->Build and Run for MSBuild verbosity set to at least 'Minimal', I'm not sure about 'Quiet'.
I would like to add a header to a cppnet-lib basic_response object. However, I am getting compilation errors.
I can add a header to a basic_request as follows which compiles ok:
boost::network::http::basic_request<boost::network::http::tags::http_server> request;
request << header("test", "test");
However, doing the same for a response object as follows receives a compilation error:
boost::network::http::basic_response<boost::network::http::tags::http_server> response;
response << header("test", "test");
Compilation error:
'headers_container_type': the symbol to the left of a '::' must be a type (header.hpp)
'value_type': is not a member of boost::network::http::basic_response<boost::network::http::tags::http_server> (header.hpp)
syntax error: missing ';' before identifier 'value_type' (header.hpp)
This would suggest that this isn't possible on a response object, but following the following page seems to suggest it is. I'm obviously going wrong somewhere!
Documentation: http://cpp-netlib.org/0.8/reference_http_response.html
My environment is:
Visual Studio 2013 (building as Release)
Boost 1.55
cppnet-lib: 0.11.0
Any help would be very much appreciated! Thanks.
First, I think you're using the wrong documentation since you're using version 0.11.0 (I suggest you use 0.11.1, which has a lot of bug fixes on top of 0.11.0). Here's the link you actually want for the 0.11.0 documentation:
http://cpp-netlib.org/0.11.0/reference/http_server.html#response-object
Second, you'd want to add headers directly to the response object's headers member. No need to use functions to do this:
struct my_server {
void operator(server::request const& req, server::response & res) {
// do something with the request and/or response
res.headers.push_back(server::response::header("Name", "value"));
// do more things
}
// ...
};
I ran into a problem with the Eclipse formatter. It won't format my code correctly when declaring methods within a class declaration. It puts a new line after the method's return type.
I already exported the style xml file and examined the settings in it, but none of the settings have any apparent connection to this problem, and the settings editor in Eclipse didn't show the same problem happening in it's sample code for method declarations.
Here is an example bit of code for what I want to have happen:
class MyClass
{
public:
MyClass();
void myMethod();
};
However, this is what I get:
class MyClass
{
public:
MyClass();
void
myMethod();
};
Again, in the styles editor, the code doesn't have this problem and looks just how I want it to, but in the actual code, the story is different.
I'm using version 3.8.0. Any help is appreciated.
Edit: I deleted those source files that were formatted incorrectly (after formatting the code several times to no avail) and replaced them with "identical" files with the same methods, same structure, etc. I formatted the code this time and it worked. This is probably a bug, but I'm leaving it up just in case anyone else encounters a similar problem or has a solution to avoiding this problem in the first place.
I hand edited two files under the main eclipse projects directory
.metadata\.plugins\org.eclipse.core.runtime\.settings
The two files:
file 1: org.eclipse.cdt.core.prefs, change this line from "insert" to "do not insert"
org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert
file 2: org.eclipse.cdt.ui.prefs,
scan this file for "insert_new_line_before_identifier_in_function_declaration" and make a similar change from insert to do not insert next to it, should be obvious
Note I seen this problem on indigo and juno, the fix described above was in juno.
If you have a custom formatter config, export it first (settings>C/C++ General>Formatter>Edit>Export). Then change the following line to "do not insert". Save the XML.
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration" value="do not insert"/>
Delete the current config and import the one you changed.
There's a specific preference in the formatter options starting from cdt 9.8 included in Eclipse 2019-06.
I am working on a c++ project (and I'm a complete c++ n00b) that uses the root namespace to access the ::tolower method in the following lines of code, but I have changed some build settings and am getting an error.
CCString * CCBReader::toLowerCase(CCString * pString) {
std::string copy(pString->getCString());
std::transform(copy.begin(), copy.end(), copy.begin(), ::tolower);
return CCString::create(copy.c_str());
}
The build changes are essential for most of the project, and changing these is not an option. So as a workaround, I would like to try prefixing this with the root namespace. For example:
std::transform(copy.begin(), copy.end(), copy.begin(), rootns::tolower);
Is this possible? If so, how?
Since many of you have already disregarded my ideal solution as impossible, and have asked what the error is to see if you can solve it your own way, here is the relevant portion of the error:
error: '::tolower' has not been declared
The root namespace does not have a name, so there is no other way to address it.
Instead, you're going to have to re-examine your build changes, and maybe consider what exactly the error you get says. The error might not really be about namespaces. It could have been triggered by some other problem earlier in your code.
I added a new value (NULL_IS_NOT_NIL) to an enum in ksql.h
enum
{
PKEY = 0x000001,
NONCOLUMN = 0x000010,
EXPRESSION = 0x000010,
INSERTONLY = 0x000100,
NUMERIC = 0x001000,
NULL_IS_NOT_NIL = 0x010000,
MAXLEN_TABLENAME = 50
};
Unfortunately, this:
Row.SetExtras ("COMMENT2", KROW::NULL_IS_NOT_NIL);
Throws an error.
db.cpp:7727: error: âNULL_IS_NOT_NILâ was not declared in this scope
On the other hand
Row.SetExtras ("COMMENT2", 0x010000);
and
Row.SetExtras (vendor_id, KROW::NUMERIC);
Both work fine and do not throw errors. Right now I can get by by replacing NULL_IS_NOT_NIL with 0x010000, but that is a bad idea. Is there a reason that I am getting this error? Have I missed something obvious?
You've made the changes in the header file, but they are not being reflected in your project. As stated in the comments, the cause was due to it not being pushed to the right folder.
You forgot to give the enum a name: KROW is missing from your code snippet.
On the other hand, if you call it KROW, you will get a redefinition error. So you need to come up with a different solution. (Unless you are editing the system header file directly -- but surely not...)