Menu

CTB for serial coms

2005-11-05
2012-09-26
  • Nobody/Anonymous

    hello!

    I'm developing an application for RS232 comunications.

    Im using Win XP, Dev-C++ and wxwidgets.

    I want to use CTB (http://www.iftools.com/ctb.en.html) for serial coms, so I want to compile it with Dev-C++ as a static library.

    Does any body have make file for Dev-c++?

    Thank you very much.

     
    • Nobody/Anonymous

      Hello Clifford.

      Thank you very much for your job. It works the way you say. I put library in a fancy folder, but everything else your way.

      Thank you again.

       
    • Anonymous

      Anonymous - 2005-11-05

      I downloaded it and took a look at the supplied makefiles for Visual C++ and Linux to determine how to build it. It is a very simple build and does not require anything particularly special.

      I built it in the following way:

      1) File->New->Project..., Set Name to libwxctb, select Static Library, and set languate to C++, Click OK, and save the libwxctb.dev file in the root of your CTB source ($WXWIN/contrib/src/ctb if you are following the CTB instructions).

      2) Project->Add to project, navigate to the src\ctb folder and add the following:
      scan.cpp
      expect.cpp
      iobase.cpp
      match.cpp

      3) Project->Add to project, navigate to the src\ctb\windows folder and add the following:
      serport.cpp
      timer.cpp
      getopt.cpp

      4) Project->Project options->Parameters, add -I.\include in the C++ parameters box.

      5) Build it.

      6) Install it manually. You could create an after-all custom rule and use Dev-C++'s makefile customisation to install it automatically. But rather than go into all that, you could just follow these steps:

      a) Copy the resilting libwxctb.a file to $(WXDIR)\lib\
      b) Copy the header files in the ctb download include\wx\ctb folder to $(WXDIR)\include\wx\ctb
      c) Copy the header files in the ctb download include\wx\ctb\win32 folder to $(WXDIR)\include\wx\ctb\win32

      You are of course free to put the library and headers anywhere you please, but the locations I have suggested are the ones used by the provided VC++ makefile.

      You should then be good to go, although I have not tested the resulting library, I see no reason why it should not work.

      For reference my compile log for the libarray looked like this:

      Compiler: Default compiler
      Building Makefile: "E:\Devprojects\ctblib\Makefile.win"
      Executing make clean
      rm -f src/ctb/scan.o src/ctb/expect.o src/ctb/iobase.o src/ctb/match.o src/ctb/win32/serport.o src/ctb/win32/timer.o src/ctb/win32/getopt.o libwxctb.a

      gcc.exe -c src/ctb/scan.cpp -o src/ctb/scan.o -I"include" -Wall

      gcc.exe -c src/ctb/expect.cpp -o src/ctb/expect.o -I"include" -Wall

      gcc.exe -c src/ctb/iobase.cpp -o src/ctb/iobase.o -I"include" -Wall

      gcc.exe -c src/ctb/match.cpp -o src/ctb/match.o -I"include" -Wall

      gcc.exe -c src/ctb/win32/serport.cpp -o src/ctb/win32/serport.o -I"include" -Wall

      src/ctb/win32/serport.cpp: In member function `virtual int wxSerialPort::Ioctl(int, void*)':
      src/ctb/win32/serport.cpp:97: warning: unused variable 'brk'

      gcc.exe -c src/ctb/win32/timer.cpp -o src/ctb/win32/timer.o -I"include" -Wall

      gcc.exe -c src/ctb/win32/getopt.cpp -o src/ctb/win32/getopt.o -I"include" -Wall

      ar r libwxctb.a src/ctb/scan.o src/ctb/expect.o src/ctb/iobase.o src/ctb/match.o src/ctb/win32/serport.o src/ctb/win32/timer.o src/ctb/win32/getopt.o

      ar: creating libwxctb.a

      ranlib libwxctb.a

      Execution terminated

      Note the Unused variable warning for serport.cpp. You could fix that easily. I was surprised it was there because the -Wall option was in the Linux makefile. I had to remove the -Werror option I normally use to allow it to build.

      I have not included the GPIB files in this build. You might wish to do that if you have GBIP hardware.

      To use the library you would have to add the libraries installation path and header paths to your project options, and add -lwxctb to the linker options.

      Hope that helps. Report back.

      Clifford

       
    • Anonymous

      Anonymous - 2005-11-05

      Interestingly the CTB website claims that it has makefiles for MinGW, but the only one in the download (makefile.g95) only builds the sample code, not the library.

      Clifford

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.