Hi all,

I get into trouble when trying to build a dll from my GNURadio OOT module
with Visual Studio 2013.  I really appreciate if you could help me to solve
this issue.

I have installed:
GNURadio (got at
http://files.ettus.com/binaries/gnuradio/gnuradio_v3.7.2.2/gnuradio_3.7.2.2_Win32.exe
<http://files.ettus.com/binaries/gnuradio/gnuradio_v3.7.2.2/gnuradio_3.7.2.2_Win32.exe%29>
)
in C:\Program Files (x86).
boost 1.57.0 in C:\local.

Attached please find my gr-test project files.
 I have set the properties of the project as follow:

C/C++>> General >> Additional Include Directories:
D:\install_src\uhdtest\gr-test\include;C:\local\boost_1_57_0;C:\Program
Files %28x86%29\gnuradio\include;%(AdditionalIncludeDirectories)

Linker >> General >> Additional Library Directories:
C:\Program Files
%28x86%29\gnuradio\lib;C:\local\boost_1_57_0\lib32-msvc-12.0;%(AdditionalLibraryDirectories)

Linker >> General >> Input:
gnuradio-pmt.lib;volk.lib;gnuradio-runtime.lib;%(AdditionalDependencies)

But when build the dll, some errors occur:
1>------ Build started: Project: gr-test, Configuration: Release Win32
------
1> add_const_ff_impl.cc
1>lib\add_const_ff_impl.cc(33): warning C4273:
'gr::test::add_const_ff::make' : inconsistent dll linkage
1> D:\install_src\uhdtest\gr-test\include\test/add_const_ff.h(49) : see
previous definition of 'make'
1> Creating library D:\install_src\uhdtest\gr-test\Release\gr-test.lib and
object D:\install_src\uhdtest\gr-test\Release\gr-test.exp
1>add_const_ff_impl.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) public: virtual __thiscall
gr::test::add_const_ff::~add_const_ff(void)" (__imp_??1add_const_ff@test@gr@
@UAE@XZ)
1>add_const_ff_impl.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) public: __thiscall
gr::test::add_const_ff::add_const_ff(void)" (__imp_??0add_const_ff@test@gr@
@QAE@XZ)
1>D:\install_src\uhdtest\gr-test\Release\gr-test.dll : fatal error LNK1120:
2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

How to deal with them?

Best regards,
Damon
/* -*- c++ -*- */
/* 
 * Copyright 2015 <+YOU OR YOUR COMPANY+>.
 * 
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 * 
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this software; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */


#ifndef INCLUDED_TEST_ADD_CONST_FF_H
#define INCLUDED_TEST_ADD_CONST_FF_H

#include <test/api.h>
#include <gnuradio/sync_block.h>

namespace gr {
  namespace test {

    /*!
     * \brief <+description of block+>
     * \ingroup test
     *
     */
    class TEST_API add_const_ff : virtual public gr::sync_block
    {
     public:
      typedef boost::shared_ptr<add_const_ff> sptr;

      /*!
       * \brief Return a shared_ptr to a new instance of test::add_const_ff.
       *
       * To avoid accidental use of raw pointers, test::add_const_ff's
       * constructor is in a private implementation
       * class. test::add_const_ff::make is the public interface for
       * creating new instances.
       */
      static sptr make(float k);
    };

  } // namespace test
} // namespace gr

#endif /* INCLUDED_TEST_ADD_CONST_FF_H */

/*
 * Copyright 2011 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * GNU Radio is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * GNU Radio is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GNU Radio; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */

#ifndef INCLUDED_TEST_API_H
#define INCLUDED_TEST_API_H

#include <gnuradio/attributes.h>

#ifdef gnuradio_test_EXPORTS
#  define TEST_API __GR_ATTR_EXPORT
#else
#  define TEST_API __GR_ATTR_IMPORT
#endif

#endif /* INCLUDED_TEST_API_H */
/* -*- c++ -*- */
/* 
 * Copyright 2015 <+YOU OR YOUR COMPANY+>.
 * 
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 * 
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this software; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <gnuradio/io_signature.h>
#include "add_const_ff_impl.h"

namespace gr {
  namespace test {

    add_const_ff::sptr
    add_const_ff::make(float k)
    {
      return gnuradio::get_initial_sptr
        (new add_const_ff_impl(k));
    }

    /*
     * The private constructor
     */
    add_const_ff_impl::add_const_ff_impl(float k)
      : gr::sync_block("add_const_ff",
              gr::io_signature::make(1, 1, sizeof(float)),
              gr::io_signature::make(1, 1, sizeof(float))),
              d_k(k)
    {}

    /*
     * Our virtual destructor.
     */
    add_const_ff_impl::~add_const_ff_impl()
    {
    }

    int
    add_const_ff_impl::work(int noutput_items,
			  gr_vector_const_void_star &input_items,
			  gr_vector_void_star &output_items)
    {
        const float *in = (const float *) input_items[0];
        float *out = (float *)output_items[0];

        // Do <+signal processing+>
        for (int index = 0; index < noutput_items; index++)
            out[index] = in[index] + d_k;

        // Tell runtime system how many output items we produced.
        return noutput_items;
    }

  } /* namespace test */
} /* namespace gr */

/* -*- c++ -*- */
/* 
 * Copyright 2015 <+YOU OR YOUR COMPANY+>.
 * 
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 * 
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this software; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */

#ifndef INCLUDED_TEST_ADD_CONST_FF_IMPL_H
#define INCLUDED_TEST_ADD_CONST_FF_IMPL_H

#include <test/add_const_ff.h>

namespace gr {
  namespace test {

    class add_const_ff_impl : public add_const_ff
    {
     private:
         float d_k;

     public:
      add_const_ff_impl(float k);
      ~add_const_ff_impl();

      // Where all the action really happens
      int work(int noutput_items,
	       gr_vector_const_void_star &input_items,
	       gr_vector_void_star &output_items);
    };

  } // namespace test
} // namespace gr

#endif /* INCLUDED_TEST_ADD_CONST_FF_IMPL_H */

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

Reply via email to