|
| davinci (5) | ||||
| Hi! I'm fairly new to programming in C++ (only done Java before). I try to read data from a *.dat file. As this file is selcted by the user via a GUI(done with QT) there isn't one special file to test with. I wrote the following method to read the data - there are 3 times 2 bytes at the beginning of each *.dat file which specify the amount of data given for x, y and z direction - this is why I only try to read these 2 bytes for the beginning
I did include: #include <QtGui> #include <iostream> #include <fstream> #include <QString> #include <string> #include "mainwindow.h" #include "glwidgetmain.h" #include "window.h" #include "stdio.h" when trying to build the project I receive the following error:
I guess I missed an include but I can't get rid of this error so far no matter what I try. Thanks for your help! | ||||
Last edited on | ||||
| guestgulkan (1037) | |
| Have you linked against the appropriate QT library?. | |
| davinci (5) | |
| yes I linked against "$(QTDIR)\lib"; where QTDIR is defined in the windows environment variables as path to the QT folder all other methods needing QT do work fine - so I guess linking QT is ok | |
| guestgulkan (1037) | |
| It is just that: 1. The QString stuff is in the qtcore library (QT has about 30 libraries) 2. The QString::toWCharArray function did not appear in QT until version 4.2 (And another thing is that you actually have to allocate the WCHAR buffer - which you are not actually doing); | |
| davinci (5) | |
| Thanks for your help so far! I use QT 4.5.3 - do I have to link each library needed on its own? I do link the whole library folder which holds QtCore4.lib as well. Is this the one meant? concerning the WCHAR issue I added the following: int namelength = fileName.length(); WCHAR * file; file = (WCHAR *) malloc (namelength); fileName.toWCharArray(file); to allocate the buffer - I'm not sure wether I did it correctly? Unfortunately I still receive the same error! | |
| guestgulkan (1037) | |
| You link libraries as required. QtCore4.lib is the one I'm particularly thinking about (QtCore4d.lib is the debugging version) How are you using qt - are you using an IDE - if so which one - we should be able to get this thing sorted in no time at all. | |
| davinci (5) | |
| I'm not using an IDE - I downloaded the QT sources, compiled them and installed the addin for msvc I started using the QT creator but switched to doing the GUI moddeling without creator | |
| guestgulkan (1037) | |
| Ah, that is what I use. I really like it. Bring up the project properties dialog and go linker ->input What (libraries) have you got listed in the Additional Dependencies box?? | |
| davinci (5) | |
| yeah QT works quite nice - but it's a big change to switch from Java and especially Eclipse to C++ and MSVC this is what I've got as Additional Dependencies: opengl32.lib glu32.lib gdi32.lib user32.lib $(QTDIR)\lib\qtmaind.lib $(QTDIR)\lib\QtOpenGLd4.lib $(QTDIR)\lib\QtGuid4.lib $(QTDIR)\lib\QtCored4.lib glew32.lib devil.lib | |
| guestgulkan (1037) | |
| Damn, looks like the appropriate library is being linked. I will try to duplicate the error tomorrow. | |
| guestgulkan (1037) | |
| I tried the function and it worked for me. (My QT version is 4.3.3). (Do a project clean and rebuild and see what happens) | |
Registered users can post in this forum.
