16,238
社区成员
发帖
与我相关
我的任务
分享
#ifndef TESTDLL_H
#define TESTDLL_H
#include "TestDll_global.h"
class TESTDLLSHARED_EXPORT TestDll {
public:
TestDll();
void writeFile();
};
#endif // TESTDLL_H
#ifndef TESTDLL_GLOBAL_H
#define TESTDLL_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(TESTDLL_LIBRARY)
# define TESTDLLSHARED_EXPORT Q_DECL_EXPORT
#else
# define TESTDLLSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // TESTDLL_GLOBAL_H
#include "testdll.h"
#include <fstream>
using namespace std;
TestDll::TestDll()
{
}
void TestDll::writeFile()
{
ofstream out("test.txt");
out<<"youSonofbitch"<<endl;
out.close();
}
#include <QtCore/QCoreApplication>
#include "testdll.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
TestDll *test = new TestDll();
test->writeFile();
return a.exec();
}
#-------------------------------------------------
#
# Project created by QtCreator 2012-05-01T16:50:30
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = C++DllTest
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
LIBS += "TestDll.dll"
SOURCES += main.cpp