Linker error with QtGui module, method doesn't exist in CE?
I wasn't sure whether this problem should go in the Qt for embedded sub forum, but I'm at least pretty sure this is a more general issue. If anyone tells me differently, I'll move the thread.
I'm working on an application, based on the Hello GL ES example for windows CE. After some pain stacking work and debugging, I have the application working brilliantly on my windows desktop, but when I try compiling in visual studio for deployment, I get the following linker error.
Quote:
Error 1 error LNK2019: unresolved external symbol getenv referenced in function jinit_memory_mgr QtGui.lib PlotPlanPlayerV3
"getenv()" is a function which isn't defined for windows CE (and is apparently, outdated). Is there some alternative to this I can use? Can I just place in an empty class to satisfy the extern, or will that upset the systems operation?
For reference, this is Qt 4.7.0, with a static build using the following options (in case this is relevant in the slightest!)
Quote:
configure -platform win32-msvc2008 -xplatform wince50standard-armv4i-msvc2008 -nomake examples -nomake demos -no-qt3support -no-declarative -no-webkit -no-phonon -no-phonon-backend -opengl-es-cm -opensource -release -graphicssystem opengl -static
Thanks in advance, any help is really appreciated!
Re: Linker error with QtGui module, method doesn't exist in CE?
getenv() is a standard C function for retrieving environment variables so it should exist for any platform supporting ANSI C (and it's not outdated). You might try qgetenv() instead but it probably calls getenv() anyway.
Re: Linker error with QtGui module, method doesn't exist in CE?
From looking through the windows CE documentation, it isn't available for that platform. Sorry for calling it outdated, thats just the impression I got from a quick google search.
The problem is, this isn't a problem caused by my code. It looks like the QtGui object has a call to something not compatable with windows CE, and I don't want to change the Qt code unless completely necessary.
I'm trying to put through an alternative (hopefully) compatable implementation using registry values to satisfy the linker error in the mean time, but if there is something else I should be doing, I'll be happy to do it.
Re: Linker error with QtGui module, method doesn't exist in CE?
What is "PlotPlanPlayer" anyway? It's not part of Qt.
Re: Linker error with QtGui module, method doesn't exist in CE?
Its the name of the application I'm making.
Re: Linker error with QtGui module, method doesn't exist in CE?
Qt should solve this for you.
Where do you call getenv()?
Re: Linker error with QtGui module, method doesn't exist in CE?
Quote:
Originally Posted by
Willybood
Its the name of the application I'm making.
So replace your call to getenv() with a call to qgetenv() and you should be fine.
Re: Linker error with QtGui module, method doesn't exist in CE?
Quote:
Originally Posted by
wysota
So replace your call to getenv() with a call to qgetenv() and you should be fine.
Quote:
Originally Posted by tbscope
Where do you call getenv()?
Thats the thing, theres no call to getenv() in any of the code I've written. Judging by the error, it must be in some third party piece of code, and considering how the error references "QtGui.lib", possibly in Qt!
It's more likely I haven't set something up correctly, I'm just not sure what. If I get time tonight, I'll try to do the same operation with the original openGL ES example, see if that works. If not, I'll experiment with creating a new shadow build with some altered configuration settings.
Is there any chance I could be using something which isn't compatable with windows CE?
Thanks for the help by the way, If theres anything you need to know about my setup, let me know!
Re: Linker error with QtGui module, method doesn't exist in CE?
Quote:
Originally Posted by
Willybood
Thats the thing, theres no call to getenv() in any of the code I've written. Judging by the error, it must be in some third party piece of code, and considering how the error references "QtGui.lib", possibly in Qt!
No, it's not in Qt. Qt builds fine on WinCE, many people use it.
Quote:
Is there any chance I could be using something which isn't compatable with windows CE?
If some library uses getenv() then yes. But you can always redefine getenv as qgetenv().
Code:
char *getenv(const char *name) {
ba = qgetenv(name);
return ba.data();
}
Re: Linker error with QtGui module, method doesn't exist in CE?
That looks like a good solution!
I am having some problems implementing it though, but the problem is more with my C++ skills. I've placed the method in as a global function, but I'm still getting the "unresolved external" error. Is there something that I'm missing to get this recognised by an external library?
In the mean time, I'm experimenting with a new build of Qt, and early next week when I get some time, I'll do a dry run with the hello es example.
Thanks for all your help so far!
Re: Linker error with QtGui module, method doesn't exist in CE?
Hi,
currently I'm facing the same problem. The unresolved external symbol message appears even while trying to compile this program, that doing nothing:
Code:
#include <QtGui/QApplication>
int main(int argc, char *argv[])
{
return a.exec();
}
I must say, that the problem appears only in the static build. Before this, I used the standard version of Qt WinCE and there was no problem with linking. Now when I try to compile my app, about 8 unresolved externals are displayed (see the log). Unfortunately non-static version is unacceptable for me because of huge size of DLLs.
Qt was configured with these params:
Quote:
configure -static -release -platform win32-msvc2008 -xplatform wincewm65professional-msvc2008 -nomake examples -nomake demos -no-qt3support -no-phonon -no-phonon-backend -opensource
Re: Linker error with QtGui module, method doesn't exist in CE?
Hey Audio, glad to hear its not just me!
I just tried with only the original hello GL-ES example, and I'm getting the same issue.
For me though, I don't necessarily need a static build. I'll recompile it later with a dynamic build, see if I have any more luck.
Sorry I cant help you, but thanks for helping me!
Re: Linker error with QtGui module, method doesn't exist in CE?
Hi Willybood,
you're welcome. A few minutes ago I've recompiled Qt with the same parameters I noticed in my first post except the static parameter, and it's working fine.
Also, I maybe found the solution how to change the size of libraries - qconfig tool. I'll test it when I finish my app, because at this time I don't know exactly what libraries the application will require. Anyway, it's step forward :) and I hope I won't need to use static libs.
Re: Linker error with QtGui module, method doesn't exist in CE?
Final update to this issue, it turns out it was a problem with the file 'jmemmgr.c'. There was a preprocessor #ifdef in there, which when 'NO_GETENV' is defined stops getenv() being referenced in the function. And for whatever reason, the Qt installer didn't set it.
After modifying the source to add it, it ran fine. I've placed a report on the Qt bug tracker, hopefully in the next version it will be fine.