wxstring未定义的引用

时间:2011-12-07 02:31:09

标签: wxwidgets undefined-reference

在使用wxgtk链接程序时,我得到了未定义的引用。我试过来自其他地方的建议,比如定义unicode宏和--no-as-needed,但都没有解决问题。这些是链接器错误的示例:

undefined reference to `wxStringBase::InitWith(wchar_t const*, unsigned int, unsigned int)'
undefined reference to `wxString::mb_str(wxMBConv const&) const'
undefined reference to `operator+(wchar_t const*, wxString const&)'

这是用于链接的行:

/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-g++ -o Aria -pthread -Wl,
  -rpath,/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib -Wl,
  --rpath,/mnt/utmp/aria/lib/ rtmidi/RtMidi.o irrXML/irrXML.o 
  ibjdkmidi/src/jdkmidi_smpte.o libjdkmidi/src/jdkmidi_edittrack.o 
  libjdkmidi/src/jdkmidi_process.o libjdkmidi/src/jdkmidi_fileshow.o
  libjdkmidi/src/jdkmidi_showcontrolhandler.o libjdkmidi/src/jdkmidi_matrix.o
  libjdkmidi/src/jdkmidi_midi.o libjdkmidi/src/jdkmidi_file.o 
  libjdkmidi/src/jdkmidi_advancedsequencer.o libjdkmidi/src/jdkmidi_filewrite.o 
  libjdkmidi/src/jdkmidi_showcontrol.o libjdkmidi/src/jdkmidi_filereadmultitrack.o 
  libjdkmidi/src/jdkmidi_sequencer.o libjdkmidi/src/jdkmidi_multitrack.o 
  libjdkmidi/src/jdkmidi_tick.o libjdkmidi/src/jdkmidi_queue.o 
  libjdkmidi/src/jdkmidi_manager.o libjdkmidi/src/jdkmidi_filewritemultitrack.o 
  libjdkmidi/src/jdkmidi_track.o libjdkmidi/src/jdkmidi_msg.o 
  libjdkmidi/src/jdkmidi_tempo.o libjdkmidi/src/jdkmidi_fileread.o 
  libjdkmidi/src/jdkmidi_driverdump.o libjdkmidi/src/jdkmidi_keysig.o       
  libjdkmidi/src/jdkmidi_parser.o libjdkmidi/src/jdkmidi_driver.o libjdkmidi/src/jdkmidi_sysex.o libjdkmidi/src/win32/jdkmidi_driverwin32.o Src/LeakCheck.o Src/PresetManager.o Src/UnitTest.o Src/PreferencesData.o Src/UnitTestUtils.o Src/AriaCore.o Src/Clipboard.o Src/languages.o Src/main.o Src/Singleton.o Src/Editors/ScoreEditor.o Src/Editors/RelativeXCoord.o Src/Editors/ControllerEditor.o Src/Editors/KeyboardEditor.o Src/Editors/DrumEditor.o Src/Editors/GuitarEditor.o Src/Editors/Editor.o Src/Dialogs/AboutDialog.o Src/Dialogs/TrackPropertiesDialog.o Src/Dialogs/TuningDialog.o Src/Dialogs/PresetEditor.o Src/Dialogs/Preferences.o Src/Dialogs/CustomKeyDialog.o Src/Dialogs/CopyrightWindow.o Src/Dialogs/CustomNoteSelectDialog.o Src/Dialogs/WaitWindow.o Src/Dialogs/ScaleDialog.o Src/Dialogs/PrintSetupDialog.o Src/Midi/InstrumentChoice.o Src/Midi/GuitarTuning.o Src/Midi/ControllerEvent.o Src/Midi/KeyPresets.o Src/Midi/MeasureData.o Src/Midi/DrumChoice.o Src/Midi/Track.o Src/Midi/MagneticGrid.o Src/Midi/Sequence.o Src/Midi/CommonMidiUtils.o Src/Midi/Note.o Src/Midi/TimeSigChange.o Src/Midi/Players/PlatformMidiManager.o Src/Midi/Players/NullDevice.o Src/Midi/Players/Sequencer.o Src/Midi/Players/Alsa/AlsaPlayer.o Src/Midi/Players/Alsa/AlsaPort.o Src/Midi/Players/Alsa/AlsaNotePlayer.o Src/Midi/Players/Mac/OutputBase.o Src/Midi/Players/Mac/MacPlayerInterface.o Src/Midi/Players/Mac/CoreMIDIOutput.o Src/Midi/Players/Mac/AudioUnitOutput.o Src/Midi/Players/Example/ExamplePlayer.o Src/Midi/Players/Jack/JackMidiManager.o Src/Midi/Players/Win/WinPlayer.o Src/IO/MidiFileReader.o Src/IO/IOUtils.o Src/IO/AriaFileWriter.o Src/IO/MidiToMemoryStream.o Src/Analysers/SilenceAnalyser.o Src/Analysers/ScoreAnalyser.o Src/Actions/DeleteTrack.o Src/Actions/SnapNotesToGrid.o Src/Actions/ScaleSong.o Src/Actions/Duplicate.o Src/Actions/RearrangeNotes.o Src/Actions/ShiftBySemiTone.o Src/Actions/InsertEmptyMeasures.o Src/Actions/RemoveOverlapping.o Src/Actions/Record.o Src/Actions/Paste.o Src/Actions/EditAction.o Src/Actions/ResizeNotes.o Src/Actions/MoveNotes.o Src/Actions/AddControllerSlide.o Src/Actions/SetAccidentalSign.o Src/Actions/AddTrack.o Src/Actions/UpdateGuitarTuning.o Src/Actions/AddNote.o Src/Actions/ScaleTrack.o Src/Actions/RemoveMeasures.o Src/Actions/DeleteSelected.o Src/Actions/SetNoteVolume.o Src/Actions/ShiftFrets.o Src/Actions/ShiftString.o Src/Actions/NumberPressed.o Src/Actions/AddControlEvent.o Src/Pickers/MagneticGridPicker.o Src/Pickers/VolumeSlider.o Src/Pickers/KeyPicker.o Src/Pickers/TuningPicker.o Src/Pickers/ControllerChoice.o Src/Pickers/TimeSigPicker.o Src/Pickers/InstrumentPicker.o Src/Pickers/NotePickerWidget.o Src/Pickers/DrumPicker.o Src/Renderers/wxImage.o Src/Renderers/AbstractDrawable.o Src/Renderers/wxDrawable.o Src/Renderers/wxRenderPane.o Src/Renderers/GLImage.o Src/Renderers/GLwxString.o Src/Renderers/GLDrawable.o Src/Renderers/GLRenderImp.o Src/Renderers/GLPane.o Src/Renderers/wxRenderImp.o Src/Renderers/wxDCString.o Src/Printing/wxEasyPrintWrapper.o Src/Printing/KeyrollPrintableSequence.o Src/Printing/AbstractPrintableSequence.o Src/Printing/AriaPrintable.o Src/Printing/RenderRoutines.o Src/Printing/SymbolPrinter/TabPrint.o Src/Printing/SymbolPrinter/ScorePrint.o Src/Printing/SymbolPrinter/EditorPrintable.o Src/Printing/SymbolPrinter/SymbolPrintableSequence.o Src/Printing/SymbolPrinter/PrintLayout/LayoutElement.o Src/Printing/SymbolPrinter/PrintLayout/RelativePlacementManager.o Src/Printing/SymbolPrinter/PrintLayout/PrintLayoutAbstract.o Src/Printing/SymbolPrinter/PrintLayout/PrintLayoutLine.o Src/Printing/SymbolPrinter/PrintLayout/PrintLayoutNumeric.o Src/Printing/SymbolPrinter/PrintLayout/PrintLayoutMeasure.o Src/GUI/MainPane.o Src/GUI/ImageProvider.o Src/GUI/GraphicalSequence.o Src/GUI/MainFrame.o Src/GUI/MainFrameMenuBar.o Src/GUI/MeasureBar.o Src/GUI/GraphicalTrack.o
-L/mnt/utmp/aria/lib -L/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib
-Lmnt/utmp/aria/lib -Lmnt/utmp/aria/lib -L/opt/gnome/lib 
-lwx_gtk2u_core-2.8-arm-angstrom-linux-gnueabi 
-lwx_baseu-2.8-arm-angstrom-linux-gnueabi -lasound -ldl -lm -lglib-2.0

重新排列链接参数并没有改变结果,似乎链接器中使用的两个wx库应该是两个使用的。

1 个答案:

答案 0 :(得分:0)

wxString位于库wxBase中。

您正在链接

-lwx_baseu-2.8-arm-angstrom-linux-gnueabi 

我假设是wxBase库。

您可以链接示例程序吗? (答案:是)因此,请发布您用于构建其中一个示例的链接命令,以便与失败的链接命令进行比较。

看一下你的'sample'链接命令行,我注意到样本是使用非unicode版本的库编译的,而失败的链接是使用unicode版本。我建议尝试使用unicode构建样本,并且没有测试程序 - 结果应该是提供信息的。

-lwx_base_xml-2.8-arm-angstrom-linux-gnueabi
-lexpat -lwx_gtk2_adv-2.8-arm-angstrom-linux-gnueabi
-lwx_gtk2_html-2.8-arm-angstrom-linux-gnueabi
-lwx_gtk2_core-2.8-arm-angstrom-linux-gnueabi 
-lwx_base-2.8-arm-angstrom-linux-gnueabi  

该示例使用 -lwx_base_xml-2.8-arm-angstrom-linux-gnueabi ,但您使用 -lwx_baseu-2.8-arm-angstrom-linux-gnueabi 您是否尝试过改变了吗?