#include "vector.hpp"

Hello

I’m trying to create a block which C++ code needs to use include
“vector.hpp”. But I;m getting this error: fatal error: vector.hpp: No
such
file or directory.

Is there a way to do this?

Thank you very much.


View this message in context:
http://gnuradio.4.n7.nabble.com/include-vector-hpp-tp54344.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Hi,

Try dropping the “.hpp” portion of your include. This file does not
have
any extension and is usually included as follows:

#include

Hope this helps,

Michael

Hi

Yes, I tried to use only #include , but it gives me an error for
each vector a I use.

Vector f (at the beginning the following code) is one of the vectors
which
needs the #include “vector.hpp”.

intentooptimizar.cpp
http://gnuradio.4.n7.nabble.com/file/n54350/intentooptimizar.cpp

Thank you.


View this message in context:
http://gnuradio.4.n7.nabble.com/include-vector-hpp-tp54344p54350.html
Sent from the GnuRadio mailing list archive at Nabble.com.

It looks like you are trying to create your own vector class named
Vector
(keeping notice of the capitalized ‘V’).

These Vector method definitions need a definition for the Vector class,
which is presumably in your Vector.hpp. I would like to note that the
.hpp
extension indicates a template header library, and all of the method
definitions should be inline in the template class definition, or in an
include file; not in a compiled object file.

It appears (at least from this lone file) that you are not using
std::vector at all, and you may wish to remove the '#include
line
to keep things clean in your code and not include not used pieces of
code.

Back to your example not working, your #include “Vector.hpp” must point
to
the file that presumably contains the class definition. for this
include
to work as stated, the Vector.hpp file will have to be in the same
directory as the file that you posted; otherwise you will have to give a
relative (or absolute) path to this file in the include statement.

I hope this helps you some!

Michael

P.S. Why are you not using std::vector?

Hi!
Um, there’s no vector.hpp in GNU Radio; are you maybe referring to the
header that contains std::vector?

You would normally include that as

#include

and let your compiler figure out the file name suffix.

Best regards,
Marcus

Yes Tom, you are absolutely right. I’m sorry and thank you.


View this message in context:
http://gnuradio.4.n7.nabble.com/include-vector-hpp-tp54344p54356.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Mon, Jun 22, 2015 at 7:40 PM, Michael B. [email protected]
wrote:

std::vector at all, and you may wish to remove the '#include ’ line

Michael

P.S. Why are you not using std::vector?

David,
While I’m kind of curious about you making your own vector class, too,
this
is not about GNU Radio but generally C++ coding issues. Please move this
conversation to a more appropriate forum about programming.

Thanks,
Tom

Hello!

I think I already found a way to do this, but now I’m getting this
error:
“error: a function-definition is not allowed here before ‘{’ token”
In these parts of the code :

Vector txyz(4);
void initialize()
{
txyz[0] = 0.0;
txyz[1] = 0.0;
txyz[2] = 1.0;
txyz[3] = 0.0;
}

void PrimercruceenB()
{
char B;
char Bi;
double w = sqrt(b * (r - 1));
while (txyz[1] < w){ // Cruce con plano B en x

    RK4Step(txyz, dt);

}
// Aqui ya tengo el primer valor de x cruzando al plano B

    if (txyz[2] >= w) { // Cruce con plano B en y
            Bi = '3';
    }
    else {
            while ( txyz[2] < w) {
                    RK4Step(txyz, dt);
            }
            if (txyz[1] >= w) {
              Bi = '3';
            }
    }

}

Vector f(Vector txyz)
{
double t = txyz[0];
double x = txyz[1];
double y = txyz[2];
double z = txyz[3];
Vector f(4);
f[0] = 1;
f[1] = - sigma * x + sigma * y;
f[2] = - x * z + r * x - y;
f[3] = x * y - b * z;
return f;
}

I don’t know why I’m getting this error. Doesn’t these functions can be
recognize by GNU Radio?

Thank you.


View this message in context:
http://gnuradio.4.n7.nabble.com/include-vector-hpp-tp54344p54388.html
Sent from the GnuRadio mailing list archive at Nabble.com.

I’m getting this error while I’m trying to create a new block.
I don’t get any error when I compile it in a C++ compiler.


View this message in context:
http://gnuradio.4.n7.nabble.com/include-vector-hpp-tp54344p54390.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Tue, Jun 23, 2015 at 8:36 PM, dcardona [email protected]
wrote:

I’m getting this error while I’m trying to create a new block.
I don’t get any error when I compile it in a C++ compiler.

I’m sorry, but there is no indication of that in your original email
about
the code. It was just what looked like your own code; not inside a GNU
Radio block. Most likely, you have not properly added your class files
to
the build processing CMakeLists.txt.

Also, where is your original post? Please keep the thread readable when
replying by keeping the relevant parts of the conversation in the replay
and bottom-posting like this.

Tom

On Tue, Jun 23, 2015 at 8:15 PM, dcardona [email protected]
wrote:

txyz[1] = 0.0;

            }
    double y = txyz[2];

recognize by GNU Radio?

Thank you.

Once again, this is a C++ coding issue. I don’t even see any GNU Radio
code
in here.

Tom

I’m sorry. You are right, I will try to keep that in mind next time I
write
asking for help.


View this message in context:
http://gnuradio.4.n7.nabble.com/include-vector-hpp-tp54344p54398.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Hi David,

GNU Radio block or not, what you’re seeing is C++ error, and your code
is not really related to GNU Radio.
Since GNU Radio is written in “normal” C++, you must have made some
syntax mistake when integrating your code into the template that you get
when creating a new block.
However, that template is just a bunch of normal C++ files containing
normal classes (that’s what GNU Radio is – C++ files containing
classes); we’re typically pretty resource- and helpful when it comes to
solving issues that arise when dealing with GNU Radio code, but what
you’re giving us has no indication of where things go wrong, and how you
use that code in your C++ class. All we can tell you is that a) you seem
to have done it wrong and b) you might really need to learn how to read
and communicate compiler errors, so that you might yourself understand
better what goes wrong and how to ask for help in a manner that allows
people to see what’s wrong.

So: Make sure you find out where you didn’t write correct C++. Best
option is always to have someone who is a bit more used to that sit next
to you, and tell her/him “I wrote this code, and when I try to compile
it, I get this error”, and then let that person explain to you how they
approach figuring out where the problem lies. Even if the two of you
don’t really figure out the problem, that will lead to the both of you
learning about debugging – which is really invaluable!
If you can’t solve the problem, it’s really O.K. to ask somewhere, but
please make sure to offer all information one might need to understand
the problem; in your case that mail would have looked something like:

“I have wrote a couple of C++ <methods/classes/functions/…> to
. Now, <link to gist.github.com/pastebin.com/… or inline
code> compiles fine, but when I insert these
<methods/classes/functions/…> into my newly created block (gr_modtool
add <options you’ve used>), the following <link to full file or even
better complete OOT on gist.github.com/pastebin.com/… or inline code>
doesn’t compile. I get the error <full error, especially including line
number>.”

Then, it would have been easy for us to understand the connection to GNU
Radio, to actually see where things went wrong, and to analyze the error
– all things that you might have already guessed were important to the
solution.

But I have to agree with Tom quite a bit: what you’re having are mainly
C++ problems, and they don’t seem to be very GNU Radio-specific. So
probably sitting with someone who knows C++ (but doesn’t know GNU Radio)
makes much more sense than asking us, who know GNU Radio (and a bit of
C++) but don’t have the chance to sit next to you and talk to you about
what your code does/should do and interactively explore what you do.

Best regards,
Marcus

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs