Recent

Author Topic: Using LazSerial in Console application  (Read 7135 times)

soitjes

  • Newbie
  • Posts: 6
Using LazSerial in Console application
« on: September 10, 2013, 09:16:56 pm »
Hi,

I would like to write a console application that needs to access the serial port.  I would like to use LazSerial which I also use in LCL applications.

So I add LazSerial to the Uses clause, and then I need to add a bunch of directories to the search path in the Project Options.  I get a lot of hints and at the end some strange errors :

xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomImageList
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterMenuItem
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterMenu
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterMainMenu
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterPopupMenu
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterDragImageList
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterLazAccessibleObject
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterControl
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterWinControl
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterGraphicControl
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomControl
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterScrollingWinControl
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterScrollBox
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomFrame
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomForm
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterHintWindow
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomScrollBar
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomGroupBox
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomComboBox
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomListBox
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomEdit
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomMemo
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterButtonControl
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomButton
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomCheckBox
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterToggleBox
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterRadioButton
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomStaticText
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomLabel
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomBitBtn
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomSpeedButton
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterShape
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomSplitter
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterPaintBox
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomImage
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterBevel
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomRadioGroup
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomCheckGroup
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomLabeledEdit
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomPanel
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCustomTrayIcon
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterCommonDialog
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterFileDialog
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterOpenDialog
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterSaveDialog
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterSelectDirectoryDialog
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterColorDialog
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterColorButton
xPLRFXConsole.lpr(77,1) Error: Undefined symbol: WSRegisterFontDialog
xPLRFXConsole.lpr(77,1) Fatal: There were 49 errors compiling module, stopping

Does somebody know how to solve those undefined symbols ?  Is it actually possible to use an LCL component in a console application ?

Thanks,

Soitjes.


geno

  • Full Member
  • ***
  • Posts: 198
Re: Using LazSerial in Console application
« Reply #1 on: September 10, 2013, 09:28:02 pm »
The same errors are discussed here:
http://forum.lazarus.freepascal.org/index.php/topic,7143.msg33501.html#msg33501

  regards,
      geno
version:      Lazarus 1.9   FPC 3.0.4
   
widget set:  x-86_64-linux-gtk 2
OS:             ArchLinux/ Xfce 4.12

soitjes

  • Newbie
  • Posts: 6
Re: Using LazSerial in Console application
« Reply #2 on: September 10, 2013, 09:37:44 pm »
Thanks, that helped partially.  Interfaces was not found, with the message that I needed to add a dependency for LCL, but then I get

xPLRFXConsole.lpr(11,3) Fatal: Can not find Interfaces used by xPLRFXConsole, ppu=C:\lazarus\lcl\units\i386-win32\win32\interfaces.ppu, package LCL

So something is still missing I guess.

Soitjes.

geno

  • Full Member
  • ***
  • Posts: 198
Re: Using LazSerial in Console application
« Reply #3 on: September 11, 2013, 05:43:48 am »
Make sure you are using the correct interfaces.pp; best to open Project Inspector -> Add -> Add Files and add ../lazarus/lcl/interfaces/nogui/interfaces.pp   Answer 'yes' when asked if you want to add this  directory to the path.
Under the New Requirement tab, you should add LazSerialPort to the Package Name field as well.

If you still have problems, try using trunk (Laz 1.1 / FPC 2.7.1)  This solved  my issues with adding LazSerialPort to component palette.

  regards,
     geno
version:      Lazarus 1.9   FPC 3.0.4
   
widget set:  x-86_64-linux-gtk 2
OS:             ArchLinux/ Xfce 4.12

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Using LazSerial in Console application
« Reply #4 on: September 11, 2013, 04:35:31 pm »
Quote
xPLRFXConsole.lpr(11,3) Fatal: Can not find Interfaces used by xPLRFXConsole, ppu=C:\lazarus\lcl\units\i386-win32\win32\interfaces.ppu, package LCL
If the message is like this, then the compiler is actually managed to find the ppu, but maybe incompatible (right click and copy hidden messages in the messages window to see the full messages). Try recompiling the package (Run->Clean up build files might help).
Quote
Make sure you are using the correct interfaces.pp; best to open Project Inspector -> Add -> Add Files and add ../lazarus/lcl/interfaces/nogui/interfaces.pp   Answer 'yes' when asked if you want to add this  directory to the path.
DON'T DO THAT! Only COMPILED units should be known to the compiler. Therefore, adding LCL as dependency should be the fix.

geno

  • Full Member
  • ***
  • Posts: 198
Re: Using LazSerial in Console application
« Reply #5 on: September 11, 2013, 04:44:50 pm »
Quote
DON'T DO THAT! Only COMPILED units should be known to the compiler. Therefore, adding LCL as dependency should be the fix.
hmmm.... seems I tried that and it didn't work, maybe I am wrong there.  I will have to go back in and try it on my other system to verify what I was doing.
I had worked on this for a while, first trying to install the LazSerial component on this box with no success, and then installing it on the other system and troubleshooting the problems with the console app, so I was probably just confused  ::)

  regards,
      geno
version:      Lazarus 1.9   FPC 3.0.4
   
widget set:  x-86_64-linux-gtk 2
OS:             ArchLinux/ Xfce 4.12

soitjes

  • Newbie
  • Posts: 6
Re: Using LazSerial in Console application
« Reply #6 on: September 11, 2013, 07:54:41 pm »
Thanks for your tips.

I did "Run->Clean up build files" than then it compiled.  Now I can compile it as well with a simple compile.

Thanks again,

Soitjes.

 

TinyPortal © 2005-2018