1

I succeeded in building a program in visual studio 2012 that runs QT without the plugin. I included the QT include folder and manually added the libraries to the resources. And it compiled and ran.

Now I wanted to use QCustomPlot in the same way, without the QtAddin plugin. I tried multiple projects, where I added QCustomPlot's .h and .cpp and tried to compile, but it gives me tons of linker problems(http://pastebin.com/SWVXktBk). Can someone point me in the right direction?

Windows 7 x64, QT 5.4.1,

2
  • I have not used Visual studio to compile qt programms, but you are not linking with moc files, that are generated for qcustomplot files. Commented Apr 8, 2015 at 11:20
  • After applying moc to qcustomplot.h, should I try to add this .h and the generated.cpp to my project? Because it still gives linker errors. Commented Apr 8, 2015 at 11:56

1 Answer 1

1

After hours, I found it. As UldisK pointed, I had to moc the header. I followed everything in here: http://ldmartin68.com/QTSetup4VSNET.html

In windows cmd

moc qcustomplot.h > moc_qcustomplot.cpp

then simply add the generated file to the project, and voila worked. In the end you should have in the project:

  • the original qcustomplot.h
  • the original qcustomplot.cpp
  • the generated moc_qcustomplot.cpp
Sign up to request clarification or add additional context in comments.

1 Comment

Wish I could give this more upvotes. Also note that you have to use the Qt terminal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.