discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Global namespace Errors with Complex and xlocNum


From: Patrick Sathyanathan
Subject: Re: [Discuss-gnuradio] Global namespace Errors with Complex and xlocNum
Date: Fri, 17 Mar 2017 23:40:45 +0000

Hi Melvin,


I just found out there is nothing wrong with that version, it is correct. I got another suggestion from asking around:

From: Billy O'Neal (VC LIBS)
Sent: Friday, March 17, 2017 4:34 PM
Subject: Re: Any idea what could be causing this on MSVC17 ?

 

We are not aware of any bugs that would cause things like

 

xstring_insert.h(24): error C2143: syntax error: missing ';' before '{'

 

Is it possible that a ; is missing in the user's code at the end of stdafx.h?


--Patrick


From: Melvin J Malave Sanchez <address@hidden>
Sent: Wednesday, March 15, 2017 5:20 PM
To: Patrick Sathyanathan
Cc: Marcus Müller; GNURadio Discussion List
Subject: Re: [Discuss-gnuradio] Global namespace Errors with Complex and xlocNum
 
Hey Patrick,

That is correct, is the current version wrong or causing incompatibility issues?  
Should be noted im a novice to c++ and the handling of library has been quite troubling.
UPDATE: I removed Iostream since I commented out all cin,cout lines in order to just have the blocks declarations and connections,  and the original errors returned.  Ill include the flowgraph of what the code is supposed to resemble in case it helps.

On Wed, Mar 15, 2017 at 7:22 PM, Patrick Sathyanathan <address@hidden> wrote:

Hi Melvin,


From the error message it appears you are using version 14.10.25017 headers with MSVC17. Why is this ? Were these part of the MSVC17 distribution ?


c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include

--Patrick



From: Discuss-gnuradio <discuss-gnuradio-bounces+wpats=address@hidden> on behalf of Melvin J Malave Sanchez <address@hidden>
Sent: Wednesday, March 15, 2017 4:14 PM
To: Marcus Müller
Cc: GNURadio Discussion List
Subject: Re: [Discuss-gnuradio] Global namespace Errors with Complex and xlocNum
 
The complex and locNum errors stopped once i moved stdafx.h to the very top, thanks for the tip. However, now im getting string errors? Specifically towards xstring and string, Ill provide a few lines of those:
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xstring_insert.h(24): error C2143: syntax error: missing ';' before '{'
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xstring_insert.h(24): error C2447: '{': missing function header (old-style formal list?)
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\string(20): error C2988: unrecognizable template declaration/definition
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\string(20): error C2143: syntax error: missing ';' before '<'

I've added <string> and <cstring> but the issue still hasn't been solved and i have no clue on how to proceed. Its a real pain

You mentioned you never build gr with msvc17, what do you use?


Respectfully,

Melvin

On Wed, Mar 15, 2017 at 4:01 PM, Marcus Müller <address@hidden> wrote:

Hey :)

Ah, ok, didn't realize that. Looks like some compiler confusion, then. So, I've gotta admit, never tried to build GR with MSVC17, so here's a bit of guesswork:

* Not overly familiar with things under visual studio, but isn't it somehow customary to include stdafx.h as the very first thing?

* Since I don't immediately spot where you're using any of its functions: Why not remove #include <cmath> and see if it helps?

Best regards,

Marcus

PS: please make sure to keep the whole list in your replies – that way, more than one person has a chance to answer!


On 03/15/2017 08:41 PM, Melvin J Malave Sanchez wrote:

Hey Marcus,

thanks for the quick reply, the problem is more C++ oriented than GNU. But, im not using those math functions or any in fact explicitely anywhere in the code which leads me to believe the problem is related to the libraries and since you guys understand them more than i do im hoping for some insight on the issue.

Respectfully,

Melvin
   


On Mar 15, 2017 3:28 PM, "Marcus Müller" <address@hidden> wrote:

Hi Melvin,

Not 100% sure, it's getting late, but if you use #include cmath, wouldn't it be std::pow instead of pow? I don't really see the connection of your problem to GNU Radio, to be totally honest.

Best regards,
Marcus

On 03/15/2017 07:23 PM, Melvin J Malave Sanchez wrote:
Hi there,

I'm coding a program in C++ whose purpose is data logging, in it i'm using GNU radio libraries. In addition, i'm declaring gr hierarchical blocks in the code as they have a connect function that simplifies the complexity of the program.

I'm using Visual studio IDE with visual C compiler to run the program and as i do i get various errors which i have been trying to figure out for days. I've googled similar errors and asked in stackoverflow but i've had no luck.

Ill include some of the lines of errors i'm getting as well as some lines of code(the program is small) to make this email as clear as possible. In the attachment i included a txt file that contains the full code and errors.

---------ERRORS ------------
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xlocnum(64): error C2039: 'pow': is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xlocnum(64): error C3861: 'pow': identifier not found
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xlocnum(81): error C2039: 'powf': is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xlocnum(81): error C3861: 'powf': identifier not found
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\complex(256): error C2039: 'atan2l': is not a member of '`global namespace''
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\complex(256): error C3861: 'atan2l': identifier not found

------CODE------

int UHD_SAFE_MAIN(int argc, char *argv[])
{
 
 uhd::stream_args_t stream_args("fc32", "sc16");
 std::string device_args("serial=30DCE9E");
 std::string subdev("A:A A:B");
 std::string ant("RX2");
 
 std::string ref("default");
 double rate(5e6);
 double freq(130e6);
 double gain(0);
 double bw(1e6);
 
 
 gr::top_block_sptr tb = gr::make_top_block("fcd_nfm_rx");  // Construct a top block that will contain flowgraph blocks.
                 
 std::vector<float> bp1 = gr::filter::firdes::band_pass(1.0, 5000000.0, 128000000.0, 132000000.0, 1000000.0);

 std::vector<float> bp2 = gr::filter::firdes::band_pass(1.0, 5000000.0, 128000000.0, 132000000.0, 1000000.0);

 gr::filter::fir_filter_ccf::sptr filter1 = gr::filter::fir_filter_ccf::make(1, bp1);
 gr::filter::fir_filter_ccf::sptr filter2 = gr::filter::fir_filter_ccf::make(1, bp2);

 //head blocks
 gr::blocks::head::sptr head1 = gr::blocks::head::make(8,8448);
 gr::blocks::head::sptr head2 = gr::blocks::head::make(8, 8448);

 //skipheadblocks
 gr::blocks::skiphead::sptr skip1 = gr::blocks::skiphead::make(8, 256);
 gr::blocks::skiphead::sptr skip2 = gr::blocks::skiphead::make(8, 256);

 //converters
 gr::blocks::complex_to_float::sptr cf1 = gr::blocks::complex_to_float::make();
 gr::blocks::complex_to_float::sptr cf2 = gr::blocks::complex_to_float::make();
 gr::blocks::float_to_complex::sptr fc = gr::blocks::float_to_complex::make();

 //interleave
 gr::blocks::interleave::sptr interleave = gr::blocks::interleave::make(sizeof(gr_vector_float), 1);

 //data file
 gr::blocks::file_meta_sink::sptr file = gr::blocks::file_meta_sink::make(8, "C:\\Program Files\\GNURadio-3.7\\bin\\SDR.bin2", 5e6);
 file->set_unbuffered(false);

 //create a usrp device
 std::cout << std::endl; //this should be commented out
 gr::uhd::usrp_source::sptr usrp = gr::uhd::usrp_source::make(device_args, stream_args);
......

As for attempted solutions i included the complex and xlocnum but had no luck.
Another posible solution was that std:: is said to be undefined behaviour, so i added "using namespace std;"(which is suggested not to do but how else would i declare the strings and vector<float>) and deleted the "std::" in each line that contained it, but again no luck.

If anything is required of me do not hesitate to ask, any sort of help is greatly appreciated.


Ill include the headers im using here also:
#include <iostream>
#include "stdafx.h"
#include <cmath>
#include <uhd/usrp_source.h>
#include <filter/firdes.h>
#include <gnuradio/filter/fir_filter_ccf.h>
#include <gnuradio/top_block.h>
#include <gnuradio/blocks/head.h>
#include <gnuradio/blocks/skiphead.h>
#include <gnuradio/blocks/complex_to_float.h>
#include <gnuradio/blocks/float_to_complex.h>
#include <gnuradio/blocks/interleave.h>
#include <gnuradio/blocks/file_meta_sink.h>

--



_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
_______________________________________________ Discuss-gnuradio mailing list address@hidden https://lists.gnu.org/mailman/listinfo/discuss-gnuradio



--
Melvin J. Malavé Sánchez
Computer Engineering Undergraduate Student
University of Puerto Rico, Mayagüez Campus
Cel:939-282-1686



--
Melvin J. Malavé Sánchez
Computer Engineering Undergraduate Student
University of Puerto Rico, Mayagüez Campus
Cel:939-282-1686

reply via email to

[Prev in Thread] Current Thread [Next in Thread]