Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Transferring project from qt to visual studio
Forum Updated to NodeBB v4.3 + New Features

Transferring project from qt to visual studio

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    misoran
    wrote on last edited by VRonin
    #1

    I am having issues dealing with transferring my qt project to visual studio. My team is working on producing code in visual studio and i am trying to be able to bring my qt work in visual studio. I downloaded all the plugins for qt but im still getting a Lnk2019 unresolved external symbol error. I got it worked down to figure out its when qcustomplot is trying to be added to the visual studio project. I added the files in the folder and even linked the qtcustomplot folder. Is there something im doing wrong? I don't even have much code and it is still giving me this error. I have the qcustomplot.cpp and qcustomplot.h added to the project as well. Code and error below:

    visualizer.h

    #ifndef VISUALIZER_H
    #define VISUALIZER_H
    
    #include <QtWidgets/QMainWindow>
    #include "ui_visualizer.h"
    #include "qcustomplot.h"
    
    namespace Ui
    {
    	class Visualizer;
    }
    class Visualizer : public QMainWindow
    {
    	Q_OBJECT
    
    public:
    	Visualizer(QWidget *parent = 0);
    	~Visualizer();
    
    private:
    	Ui::VisualizerClass ui;
    };
    
    #endif // VISUALIZER_H
    
    main.cpp
    
    #include "visualizer.h"
    #include <QtWidgets/QApplication>
    
    int main(int argc, char *argv[])
    {
    	QApplication a(argc, argv);
    	Visualizer w;
    	w.show();
    	return a.exec();
    }
    

    visualizer.cpp

    #include "visualizer.h"
    
    
    Visualizer::Visualizer(QWidget *parent)
    	: QMainWindow(parent)
    {
    	ui.setupUi(this);
    }
    
    Visualizer::~Visualizer()
    {
    
    }
    

    error:
    Severity Code Description Project File Line Suppression State
    Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl QPrinter::QPrinter(enum QPrinter::PrinterMode)" (_imp??0QPrinter@@QEAA@W4PrinterMode@0@@Z) referenced in function "public: bool __cdecl QCustomPlot::savePdf(class QString const &,int,int,enum QCP::ExportPen,class QString const &,class QString const &)" (?savePdf@QCustomPlot@@QEAA_NAEBVQString@@HHW4ExportPen@QCP@@00@Z) Visualizer c:\Users\kmile\OneDrive\documents\visual studio 2015\Projects\Visualizer\Visualizer\qcustomplot.obj 1

    ^doesn't point to anything and several repeated types of this

    mrjjM 1 Reply Last reply
    0
    • M misoran

      I am having issues dealing with transferring my qt project to visual studio. My team is working on producing code in visual studio and i am trying to be able to bring my qt work in visual studio. I downloaded all the plugins for qt but im still getting a Lnk2019 unresolved external symbol error. I got it worked down to figure out its when qcustomplot is trying to be added to the visual studio project. I added the files in the folder and even linked the qtcustomplot folder. Is there something im doing wrong? I don't even have much code and it is still giving me this error. I have the qcustomplot.cpp and qcustomplot.h added to the project as well. Code and error below:

      visualizer.h

      #ifndef VISUALIZER_H
      #define VISUALIZER_H
      
      #include <QtWidgets/QMainWindow>
      #include "ui_visualizer.h"
      #include "qcustomplot.h"
      
      namespace Ui
      {
      	class Visualizer;
      }
      class Visualizer : public QMainWindow
      {
      	Q_OBJECT
      
      public:
      	Visualizer(QWidget *parent = 0);
      	~Visualizer();
      
      private:
      	Ui::VisualizerClass ui;
      };
      
      #endif // VISUALIZER_H
      
      main.cpp
      
      #include "visualizer.h"
      #include <QtWidgets/QApplication>
      
      int main(int argc, char *argv[])
      {
      	QApplication a(argc, argv);
      	Visualizer w;
      	w.show();
      	return a.exec();
      }
      

      visualizer.cpp

      #include "visualizer.h"
      
      
      Visualizer::Visualizer(QWidget *parent)
      	: QMainWindow(parent)
      {
      	ui.setupUi(this);
      }
      
      Visualizer::~Visualizer()
      {
      
      }
      

      error:
      Severity Code Description Project File Line Suppression State
      Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl QPrinter::QPrinter(enum QPrinter::PrinterMode)" (_imp??0QPrinter@@QEAA@W4PrinterMode@0@@Z) referenced in function "public: bool __cdecl QCustomPlot::savePdf(class QString const &,int,int,enum QCP::ExportPen,class QString const &,class QString const &)" (?savePdf@QCustomPlot@@QEAA_NAEBVQString@@HHW4ExportPen@QCP@@00@Z) Visualizer c:\Users\kmile\OneDrive\documents\visual studio 2015\Projects\Visualizer\Visualizer\qcustomplot.obj 1

      ^doesn't point to anything and several repeated types of this

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @misoran
      Hi
      Do you also have
      QT += printsupport
      in the .pro file?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        misoran
        wrote on last edited by VRonin
        #3

        I do. I have been playing with the code since i posted this. I was able to get rid of the error by taking out the qtcustomplot from the project and just linking the whole folder. However i think now because it is not linked to the project i am having issues connecting them. For example here is the part im talking about.

        void Visualizer::setupDemo(int demoIndex)
        {
        	switch (demoIndex)
        	{
        	case 0: setupForwardVelocityLocal(ui.customPlot); break;
        
        	}
        	setWindowTitle("Visualizer");
        	statusBar()->clearMessage();
        	ui.customPlot->replot();
        }
        

        if i do it this way it says "Ui::VisualizerClass" has no member "customplot "

        ill give you my visualizer.h file here:

        #ifndef VISUALIZER_H
        #define VISUALIZER_H
        
        #include <QtWidgets/QMainWindow>
        #include "ui_visualizer.h"
        #include "qcustomplot.h"
        
        namespace Ui {
        	class Visualizer;
        }
        
        class Visualizer : public QMainWindow
        {
        	Q_OBJECT
        
        public:
        	Visualizer(QWidget *parent = 0);
        	~Visualizer();
        
        	void setupDemo(int demoIndex);
        	void setupForwardVelocityLocal(QCustomPlot *customPlot);
        
        private:
        	Ui::VisualizerClass ui;
        	//Qstring demoName;
        	QTimer dataTimer;
        	QCPItemTracer *itemDemoPhaseTracer;
        	int currentDemoIndex;
        };
        

        is there somethign i need to add in order for the visual studio version to pick this up. This code also works completely fine in qtcreator as long as visualizer is mainwindow.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          misoran
          wrote on last edited by
          #4

          ok i was able to figure it out. If anyone find this the issue is that the ui which pop ups in the qt designer has to have that specific name. Such as i had to have a plot that says customplot or it would give me an error. Also when switching over it is best to take out qcustomplot.h and qcustomplot.cpp and just link the whole folder

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved