floyd.pepper
22nd July 2009, 05:05
Hi all,
I know there has been related questions to this on the forums. I've searched through them but none of which answer my particular problem.
Firstly, I'm a nooby, so go easy. I'm trying to learn c++ for myself and have chosen the following configuration to get started;
OS: XP
toolkit: QT 4.5.1
IDE: QT Creator 1.2
Everything is up and running and I've created some *basic* progs.
However, I'm stuck on the following problem. I wanted to learn how to use libraries. So I created a shared library (called test2library) using the QT Creator wizard and added some silly functionality. Unfortunately, I'm not able to use the linked library in my main project (called imaginatively mainProject).
// Please also let me know of any bad practice etc. As I said, I'm trying to learn here so all comments welcome in addition to the solution.//
So my shared library contains four files; test2library.h .cpp .pro and _global.h
Here are the changes I made to the header and implementation files.
test2library.h
#ifndef TEST2LIBRARY_H
#define TEST2LIBRARY_H
#include "test2Library_global.h"
#include <qDebug>
class TEST2LIBRARYSHARED_EXPORT Test2Library {
public:
Test2Library();
void doit();
};
#endif // TEST2LIBRARY_H
test2library.cpp
#include "test2library.h"
Test2Library::Test2Library()
{
}
void Test2Library::doit()
{
qDebug() << "In test2Library";
}
OK, everything compiled OK and seems to be running.
So I go back to my mainProject which is a GUI frame, also with some silly code in it. I open up my mainProject.pro and add the following lines;
<snip>
INCLUDEPATH += "..\test2Library\test2library"
win32:LIBS += -L"..\test2Library\test2library\debug" -ltest2Library
I save everything and rebuild...everything seems fine.
Then in my mainProject I add the header;
#include "../test2Library/test2library/test2library.h"
void MainWindow::on_pushButton_clicked()
{
qDebug() << "Button pressed!";
Test2Library *t = new Test2Library();
t->doit();
}
The program builds fine, but when I run it, I get
..../mainProgram.exe exited with code -1073741515
Can anyone give me any helpful pointers. I've searched for solutions but can't seem to find anything that works. I've simplified the entire process as much as possible in order to isolate the problem. It seems that there is a problem with linking the libraries?
Cheers,
Mick
I know there has been related questions to this on the forums. I've searched through them but none of which answer my particular problem.
Firstly, I'm a nooby, so go easy. I'm trying to learn c++ for myself and have chosen the following configuration to get started;
OS: XP
toolkit: QT 4.5.1
IDE: QT Creator 1.2
Everything is up and running and I've created some *basic* progs.
However, I'm stuck on the following problem. I wanted to learn how to use libraries. So I created a shared library (called test2library) using the QT Creator wizard and added some silly functionality. Unfortunately, I'm not able to use the linked library in my main project (called imaginatively mainProject).
// Please also let me know of any bad practice etc. As I said, I'm trying to learn here so all comments welcome in addition to the solution.//
So my shared library contains four files; test2library.h .cpp .pro and _global.h
Here are the changes I made to the header and implementation files.
test2library.h
#ifndef TEST2LIBRARY_H
#define TEST2LIBRARY_H
#include "test2Library_global.h"
#include <qDebug>
class TEST2LIBRARYSHARED_EXPORT Test2Library {
public:
Test2Library();
void doit();
};
#endif // TEST2LIBRARY_H
test2library.cpp
#include "test2library.h"
Test2Library::Test2Library()
{
}
void Test2Library::doit()
{
qDebug() << "In test2Library";
}
OK, everything compiled OK and seems to be running.
So I go back to my mainProject which is a GUI frame, also with some silly code in it. I open up my mainProject.pro and add the following lines;
<snip>
INCLUDEPATH += "..\test2Library\test2library"
win32:LIBS += -L"..\test2Library\test2library\debug" -ltest2Library
I save everything and rebuild...everything seems fine.
Then in my mainProject I add the header;
#include "../test2Library/test2library/test2library.h"
void MainWindow::on_pushButton_clicked()
{
qDebug() << "Button pressed!";
Test2Library *t = new Test2Library();
t->doit();
}
The program builds fine, but when I run it, I get
..../mainProgram.exe exited with code -1073741515
Can anyone give me any helpful pointers. I've searched for solutions but can't seem to find anything that works. I've simplified the entire process as much as possible in order to isolate the problem. It seems that there is a problem with linking the libraries?
Cheers,
Mick