Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get stream operators to work #139

Open
Meneleus opened this issue Sep 17, 2020 · 6 comments
Open

Can't get stream operators to work #139

Meneleus opened this issue Sep 17, 2020 · 6 comments
Assignees

Comments

@Meneleus
Copy link

Meneleus commented Sep 17, 2020

I'm working on Windows and for some reason I can't get stream operators to work. I have created a series of nodes (in my case I need them to be pointers. I tested this first by modifying one of the examples and that worked fine. However, in my code base I get an error. I'm porting a data flow application to use raftlib, converting connections to mappings. Here is my code:

for (Argument* out : function->inputs()) {
  for (Port* dest : out->connections()) {
    Statement* destStatement = dest->owner();
      raft_statement* destNode = statementMap[destStatement]; // raft_statement is a kernel
      m += (*inputNode)[out->name()] >> (*destNode)[dest->name()]; // inputNode is a kernel
    }
  }
}

The error I get is:

error C2678: binary '>>': no operator found which takes a left-hand operand of type 'raft::kernel' (or there is no acceptable conversion)
while trying to match the argument list '(raft::kernel, raft::kernel)'

Any ideas what I can be doing wrong?

@Meneleus
Copy link
Author

Let me add that I use the Qt library. I don't know why it looks to be interfering with your header files as I have stream operators defined for my classes:

QDataStream& operator<<(QDataStream& out, const Statement& statement);
QDataStream& operator>>(QDataStream& in, Statement& statement);

And I left out from the above error:

could be 'QDataStream &talon::operator >>(QDataStream &,Statement &)'

If I comment out my stream operator. The code compiles. (Though my app needs the operator...)

@jonathan-beard jonathan-beard self-assigned this Sep 19, 2020
@jonathan-beard
Copy link
Member

Hi @Meneleus, it would greatly help out debugging this if I had a minimal test case. Might I trouble you to post a link to a gist with an example that throws the error? I've tried random permutations to regenerate, however, I can't seem to hit the same errors.

Thanks in advance!

@Meneleus
Copy link
Author

Meneleus commented Sep 20, 2020

I'll try to re-create the issue. It's really strange that only that one gives me trouble, I have plenty of stream operators defined for different data types using that same signature style. I assume I can use Qt? You should have it available on Linux by default? I'll try without Qt first...

P.S. It looks like using pointers is not the issue at all. Even if I declare those kernels without pointers I still get the compile issue.

@jonathan-beard
Copy link
Member

QT should be fine, not sure if it's always default, but I've definitely installed the package. .

Thanks!

@jonathan-beard
Copy link
Member

Hi @Meneleus, I've done my best to reproduce, the only way I could generate a similar error was not adding the raftlib header files. Given the first example, and subsequent error message, I'd bet that is likely the case. Could you double check the include path? The minimum error we should be seeing (if this theory is correct) is what you posted above. I'd hope, with the right headers included that we would see an "invalid conversion" or some such error. What I think is happening is the only stream operators that your compilation process is seeing are the ones for Qt and trying to fit them...which they won't fit.

Plz let me know if this is the case, I'll close out the issue. If not, let me know and I'll keep digging.

Thanks!

@Meneleus
Copy link
Author

Meneleus commented Oct 5, 2020

I'm sorry I have not had time to create a standalone example. I do indeed #include the raftlib headers. I used

#include <raft>

I have luckily been able to comment out my stream operator that conflicts as I experiment with raftlib, so I'm not at a stoppage with this issue.

Give me a few days, I'll get to it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants