1

I would appreciate some help with the following: I'm writing a program in Visual Studio 2010 using the Qt addon, and I needed to plot some data. Consequently, I installed Qwt. The Qwt widgets are avaliable in Qt Designer (so I've done something right!). My problem is, whenever I try to reference Qwt ('include '), Visual Studio tells me that it cannot find the requested header. I've added 'C:\Qwt-6.0.1\lib\' to my 'Path' environment variable. I thought that this would be enough for Visual Studio to see it.

I'm not yet very proficient with Visual Studio. How can I ude the Qwt library in Visual Studio?

I've found that I can use Qwt's libraries in Qt Creator, just by adding 'CONFIG += qwt' to the pro file; however, my created Qt project (created in Visual Studio 2010) does not have a pro file. It has the Visual Studio equivalent.

Thanks.

Jean-Luc
  • 3,563
  • 8
  • 40
  • 78
  • Which is the path to the header files? I'm not sure it's the lib directory. And adding them to the Path env var does nothing. You will need it to the additional include directories of your project within VS. – Bart Feb 07 '12 at 10:15
  • In my project settings, I set the include directory to the include folder with all the headers and I set the lib directory to the lib folder, and now it appears to be working. – Jean-Luc Feb 07 '12 at 10:53
  • Actually, now my problem is, when I add a qwt plot widget in qt designer and I go to compile it in visual studio, it says unresolved externals and won't compile... – Jean-Luc Feb 07 '12 at 11:03
  • Then make sure you're liking against the correct libraries. – Bart Feb 07 '12 at 11:08
  • How would I do that? I tried adding 'C:\Qwt-6.0.1\lib;' to the 'additional library directory' under linker >> general. That didn't do anything. Edit: I added 'qwt.lib' to the input >> linker dependencies, and that seems to have done it. If I may ask, is doing all this standard procedure for adding any library in VS? I'm sorry, I've never had to add a library before. Thanks again! – Jean-Luc Feb 07 '12 at 11:12
  • There will be a .lib file associated to Qwt (I'm assuming the unresolved externals are related to Qwt here). Add this .lib file to the "Additional Dependencies" under Linker >> Input. – Bart Feb 07 '12 at 11:15
  • Did you resolve your problems? – Bart Feb 08 '12 at 16:09
  • Yes. Sorry, didn't relise that I hadn't accepted your answer. Thanks again for the help! – Jean-Luc Feb 09 '12 at 01:34

1 Answers1

2

Adding these paths to your PATH environment variable does nothing.

For Visual Studio to find the appropriate headers, you will need to tell it explicitly where they are. That is, you will need to add the path to the header files as one of the so called "additional include directories" of your project.

The same goes for other elements such as library directories, should you be linking against libs. The libraries themselves (their file names) can then be added under the "Additional Dependencies" at Linker >> Input.

Bart
  • 19,692
  • 7
  • 68
  • 77