View Full Version : TROUBLE MIGRATING CODE from VS2008 to QT

16th August 2011, 21:17
Hi, i'm new in QT and I have this problem.
I developed a C++ program using Visual Studio 2008, I use OpenGL for graphics and GLUI for user interface.
I would like to use QT for user interface because it seems to be easier and it looks better than GLUI.
My program uses a .lib for solving a numerical problem (arpack++), so I have some .h and some .libs besides
my own .h and .cpp files.
So, I created a new proyect, I added the .h and .cpp files and I modified the .pro file for writting the LIBS+= instruction.
When I compile the program I get a lot of compile errors like this one:
C:/Documents and Settings/Administrator/Desktop/System/././ARPACK++//arrseig.h:22: error: new.h: No such file or directory

arrseig.h is a .h file form arpack++ dll and it work fine in VisualStudio (they are the same files, without modification),
and new.h should be included in QT (it is a .h file that comes with c++).

Does someone knows if I shoul include something or configure something such that QT can use the c++ default headers????

Please help me , I've spend a week trying to solve this problem....

I'm using Qt Creator 1.3.0
Based on Qt 4.6.0 (32 bit)
Built on Nov 27 2009 at 14:53:38
From revision c0e849ecc3
Copyright 2008-2009 Nokia Corporation. All rights reserved.
On windows XP

16th August 2011, 23:15
Use the INCLUDEPATH directive in the project file to point the compiler to where the header files for your libraries reside.

17th August 2011, 16:53
Thank you for your answer, I was googling and I found out a comment that said that it should be written #include <new> instead of #include <new.h> and doing that I solved that error.

But now, I got 500 new errors of variables and methods that "was not declared in this scope". It's true that those variables were not declared in the .h file where the error is indicated, but they are declared in the .h files defined in the #include.

I'm almost giving myself up with QT :mad:. I thought it was gonna be easier.

Can someone help me?????

17th August 2011, 17:25
Your problem is not with Qt but with expecting that your compiler will depart on a quest of finding files that happen to declare the missing symbols. Do as I told you in my last post and your problems will go away.

17th August 2011, 17:43
I already do that, in the .pro I wrote the INCLUDEPATH += instruction with the address to the .h files, it still doesn't work..

17th August 2011, 17:48
Please answer the following questions:
1. What does the INCLUDEPATH statement in your project look like?
2. What do the #include statements in files that you know are included (like the aforementioned new.h) look like?
3. Where in the file system are the files the compiler is able to find and that are containing inclusions to other files that can't be found?
4. Where in the file system are the files containing the missing symbols?
5. What is the path of the directory containing your .pro file?

18th August 2011, 15:45
ok, here it goes:
1. The includepath looks like this:
INCLUDEPATH += "C:\Documents and Settings\Susy\Desktop\System\libs"\
"C:\Documents and Settings\Susy\Desktop\System"
2. For example, the include statements at arlsmat.h file are:
#include "arlspen.h"

#ifndef ARLSMAT_H
#define ARLSMAT_H
#include <stddef.h>
#include "arch.h"
#include "armat.h"
#include "arhbmat.h"
#include "arerror.h"
#include "blas1c.h"
#include "superluc.h"
#include "arlspdef.h"
#include "arlutil.h"
and the error is :C:/Documents and Settings/Administrator/Desktop/System/arlsmat.h:120: error: 'n' was not declared in this scope.
When I go to the option "Follow symbol under cursor", it goes to the definition of variable 'n' in armat.h

3. adn 4. All files are in the same folder, in the folder of the project, that will be: C:\Documents and Settings\Administrator\Desktop\System

5. C:\Documents and Settings\Administrator\Desktop\System

Thanks for helping me

18th August 2011, 15:55
So what's exactly the point of adding directories to INCLUDEPATH if no relevant files are there?

18th August 2011, 16:14
Sorry, i had a typing mistake at point 1, the include path is this (I textualy copied it)
INCLUDEPATH += "C:\Documents and Settings\Administrator\Desktop\System\libs"\
"C:\Documents and Settings\Administrator\Desktop\System"

So, in the libs folder are the .lib of arpack++

18th August 2011, 16:36
Try placing all those files in a directory without spaces in its name and try again.

18th August 2011, 16:46
Done, same 500 errors :(

18th August 2011, 19:00
What if you rename armat.h to armat.h_? Do you get a message about a missing file? If so, then your problem is unrelated to file paths but rather to file contents.