Linkerproblem "Cannot export .idata$4: symbol not found"
-
Ich habe ein wohl recht verbreitetes Problem mit meinem Linker. Verblüffend dabei ist nur, dass ich keine echte Lösung bisher im Netz gefunden habe:
Ich compiliere unter Eclipse mit CDT und als Linker habe ich den von MinGW bereitgestellten GCC.
Folgende Fehlermeldung:
Building target: GL_SDL_UI.dll Invoking: GCC C++ Linker g++ -LC:\Programmieren\Imported_Libs\SDL_Libs -shared -oGL_SDL_UI.dll ./GL_SDL_UI/TUIManager.o ./GL_SDL_UI/TglButton.o ./GL_SDL_UI/TglCheckBox.o ./GL_SDL_UI/TglClickPic.o ./GL_SDL_UI/TglComponent.o ./GL_SDL_UI/TglDragDropComponent.o ./GL_SDL_UI/TglEdit.o ./GL_SDL_UI/TglForm.o ./GL_SDL_UI/TglGroupComponent.o ./GL_SDL_UI/TglGroupItem.o ./GL_SDL_UI/TglKeyReadComponent.o ./GL_SDL_UI/TglLabel.o ./GL_SDL_UI/TglListBox.o ./GL_SDL_UI/TglMemo.o ./GL_SDL_UI/TglMouseReadComponent.o ./GL_SDL_UI/TglObject.o ./GL_SDL_UI/TglRadioButton.o ./GL_SDL_UI/TglScrollBar.o ./GL_SDL_UI/TglTextComponent.o -lSDL -lOpenGL32 -lGLU32 -lSDLmain Cannot export .idata$4: symbol not found Cannot export .idata$5: symbol not found Cannot export .idata$6: symbol not found Cannot export .text: symbol not found Cannot export SDL_NULL_THUNK_DATA: symbol not found collect2: ld returned 1 exit status mingw32-make: *** [GL_SDL_UI.dll] Error 1 mingw32-make: Target `all' not remade because of errors. Build complete for project GL_SDL_UI
Die letzten Änderungen:
Ich habe Funktionen eingebaut welche mittels SDL_ttf Schrift ausgeben sollten (OpenGL).
Ich hab dazu ein Testprojekt angelegt und die Funktion dort problemlos zum laufen bekommen. Dann habe ich den Code kopiert. Im Projekt machts dann aber Ärger.
Ich konnte sogar die Funktion und den Codeabschnitt eingrenzen der Ärger macht:void TUIManager::printText(char *text, TTF_Font *font, SDL_Color color, SDL_Rect *location, int hAlign, int vAlign) { SDL_Surface *initial; SDL_Surface *intermediary; //SDL_Rect rect; int w,h; GLuint texture; if (font == NULL) { cerr << "Font was NULL while calling TUIManager::printText()!" << endl; return; }; /* Use SDL_TTF to render our text */ //initial = TTF_RenderText_Solid(font, text, color); /* Convert the rendered text to a known format */ w = nextPowerOfTwo(initial->w); h = nextPowerOfTwo(initial->h); //-------------------Alle Funktionen in diesem Bereich machen Ärger-------------- intermediary = SDL_CreateRGBSurface(0, w, h, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); SDL_BlitSurface(initial, 0, intermediary, 0); //------------------------------------------------------------------------------- glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); /*glTexImage2D(GL_TEXTURE_2D, 0, 4, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, intermediary->pixels );*/ /* GL_NEAREST looks horrible, if scaled... */ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture); glColor3f(1.0f, 1.0f, 1.0f); GLfloat xOff, yOff = 0.0f; switch(vAlign){ case GUI_FONT_CENTER: xOff = -(w / 2.0); break; case GUI_FONT_LEFT: xOff = 0.0f; break; case GUI_FONT_RIGHT: xOff = -w; break; } switch(hAlign){ case GUI_FONT_CENTER: yOff = -(h / 2.0); break; case GUI_FONT_TOP: yOff = 0.0; break; case GUI_FONT_BOTTOM: yOff = -h; break; } /* Draw a quad at location */ glBegin(GL_QUADS); /* Recall that the origin is in the lower-left corner That is why the TexCoords specify different corners than the Vertex coors seem to. */ glTexCoord2f(0.0f, 1.0f); glVertex2f(location->x + xOff, location->y + yOff); glTexCoord2f(1.0f, 1.0f); glVertex2f(location->x + w + xOff, location->y + yOff); glTexCoord2f(1.0f, 0.0f); glVertex2f(location->x + w + xOff, location->y + h + yOff); glTexCoord2f(0.0f, 0.0f); glVertex2f(location->x + xOff, location->y + h + yOff); glEnd(); glFinish(); /* return the deltas in the unused w,h part of the rect */ location->w = initial->w; location->h = initial->h; /* Clean up */ //-------------------Alle Funktionen in diesem Bereich machen Ärger-------------- SDL_FreeSurface(initial); SDL_FreeSurface(intermediary); //------------------------------------------------------------------------------- glDeleteTextures(1, &texture); }
Wie gesagt, es geht hier nur ums Linken. Nicht um den Inhalt der Funktion.
Jetzt erklärt mir mal bitte wieso diese Funktionen Ärger machen?
-
Hat das schon jemand gelesen? Hat das schon jemand gelöst?
-
Hatte denn noch keiner von euch so ein Problem? Irgendwer hat doch immer eine Lösung, oder!? :p
-
Ich wäre so langsam auch über Vermutungen froh...
-
Ich hab auch so ein Problem gehabt. Würde mich ehrlichgesagt auch interessieren, woran das lag.
-
Ich bin jetzt schonmal einen Schritt weiter gekommen. Anscheindend hat es etwas damit zu tun, dass der Linker versucht eine Shared Library zu erstellen.
Ich hatte ja im ersten Post bereits erwähnt, dass es in einem anderen Projekt gelinkt wird. Genau dieses Project habe ich jetzt einmal so umgestellt, dass eine shared Library erstellt wird. Und siehe da, der Fehler kommt plötzlich auch in diesem Projekt.
Habt ihr jetzt ne Idee woran das scheitern könnte?
-
liegts manchmal an der Reihenfolge, wie du header und/oder die Libs einbindest?
Musste mal mit Dev C++ arbeiten, der hat ja auch den Compiler drunter und da musste man teilweise richtig drauf achten in welcher Reihenfolge man was einbindet.
-
Nein die Reihenfolge ist richtig. Denn beim erzeugen einer Exe ist die genauso und da gehts. Wie gesagt schlägt nur beim Linken von DLLs der Linker alarm.
Ich steh jetzt schon 3 Wochen auf der Stelle...wenn einer von Euch ne Lösung weiß, dann bitte schreibts...
-
und und hast den Pfad der DLL auch bei den Linkereinstellungen für Libs richtig angegeben?