This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

postgres connection from LM3S6965 EvalBoard

Other Parts Discussed in Thread: LM3S6965

Hello. I'm using LM3S6965 Eval Board and trying to connect to postgresql using libpq library. As a starting point I take enet_io example.

As said in PostgreSQL 8.4.4 Documentation (http://www.postgresql.org/docs/8.4/interactive/libpq-build.html) we must do the following 3 things:

1. "Include the libpq-fe.h header file."

I added libpq-fe.h file to the project and added line #include <libpq-fe.h> to the enet_io.c file

2. "Point your compiler to the directory where the PostgreSQL header files were installed, If you are using makefiles then add the option to the CPPFLAGS variable:

CPPFLAGS += -I/usr/local/pgsql/include"

Here I encounter some difficulies:
there is a Makefile in C:\StellarisWare\boards\ek-lm3s6965\enet_io Is that what is needed ?
I added the last line to the IPATH like this, is that right?

#
# Where to find header files that do not live in the source directory.
#
IPATH=.
IPATH+=..
IPATH+=../../..
IPATH+=../../../third_party/lwip-1.3.2/apps
IPATH+=../../../third_party/lwip-1.3.2/ports/stellaris/include
IPATH+=../../../third_party/lwip-1.3.2/src/include
IPATH+=../../../third_party/lwip-1.3.2/src/include/ipv4
IPATH+=C:\Temp\postgresql-8.4.4\src\include

3. "When linking the final program, specify the option -lpq so that the libpq
library gets pulled in, as well as the option -Ldirectory to
point the compiler to the directory where the libpq library resides. (Again, the
compiler will search some directories by default.) For maximum
portability, put the -L option before the -lpq option."

Where can I specify such options in CCS?
  • Hello,

    As these questions seem to pertain more to configuring CCS to use additional libraries, I am moving this thread to the CCS forums.  They should be able to answer these questions for you.

    Once these questions are answered for you, if  you have additional questions related to the LM3S6965 or any of the sample apps (enet_io) that you are working with, you may post additional questions in the Stellaris forum.

    In the mean time, you may wish to post a followup on this thread, once it has been moved, providing the additional details about which version of CCS  and Windows you are using.  Perhaps also some additional information about the library you are trying to link in.

    Thanks,
    Bobby

  • To add an include path for a CCS project do the following:

    -Right click on your project and select "Build Properties"

    -in the tree on the right select "Include Options" that appears under the compiler

    -There will be a box that shows include directories on the right (include search path)

    -Click on the button with a + to add an additional directory

     

    Regards,

    John

  • Thanks JohnS that seems to be the answer to 2. And what about 3? How can I specify the linker option -lpq ?

    is it somewere in -Right click -"Build Properties" - under the linker ?

    more hints will be appreciated.

  • I am not familiar with an lpq linker option in CCS.  There is a -l option (or --library) for including a library in the build.  If you go to "File Search Path" under the linker options there is a box where you can specify libraries to include.  I think this is what you are after.  The box below it is the library search path which you will likely need to use as well.

     

    Regards,

    John