Calling external functions from QT
-
wrote on 3 Jul 2013, 14:52 last edited by
Hi guys,
I developed a whole new library to do some calculations on Eclipse. Now I need to call these functions inside Qt. I added the path to PATH variable at .pro file, but when I try to compile, I get "no such file or directory" error. Any idea on how to solve this?
-
wrote on 3 Jul 2013, 15:03 last edited by
Hi ArchGabe.
Did you add LIBS += "/path/to/lib" to .pro file?
Regards. -
wrote on 3 Jul 2013, 15:04 last edited by
Yes, I did...
-
wrote on 3 Jul 2013, 15:07 last edited by
test.hpp: no such file or directory
-
wrote on 3 Jul 2013, 15:09 last edited by
Well, to do this, I'm doing..
- Add LIBS += to .pro file.
- Add .h of library to my project.
- Copy library to app folder.
Hope it's util.
Regards.
-
wrote on 3 Jul 2013, 15:28 last edited by
Actually, there is no .lib file. All I want is to import the header file, which has all the functions definitions...
-
wrote on 3 Jul 2013, 15:38 last edited by
You should use:
- INCLUDEPAT += path/to/include
In the .pro file.
-
wrote on 3 Jul 2013, 15:50 last edited by
Now I am getting multiple definition error...
-
wrote on 3 Jul 2013, 15:52 last edited by
You should include all the includes necessaries. More information would be confortable...
-
wrote on 3 Jul 2013, 15:57 last edited by
I did...
.
On Eclipse, I created a .hpp file like this:@
#ifndef FUNCTION__HPP__
#define FUNCTION__HPP__int foo() {return 2;}
#endif
@Then, I added the following path to my QT project .pro file:
@
INCLUDEPATH += /path_to_hpp_file
@My mainwindow.h
@
#include "function.hpp"
@and on my mainwindow.cpp also (wich doensn't change anything):
@
#include "function.hpp"
@Now I am getting "multiple definition" error... And I don't know why...
-
wrote on 3 Jul 2013, 16:19 last edited by
It's the method already defined in other part of your code?
-
wrote on 3 Jul 2013, 16:33 last edited by
No...
1/12