Add new libraries to C project in Visual Studio 2012

Sysprogs forums Forums VisualGDB Add new libraries to C project in Visual Studio 2012

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #857
    torben_pi
    Participant

    Hello,

    i´m working with visualGDB to program a Raspberry Pi and currently trying to add new libraries to my Visual Studio project.

    I installed the lib bcm2835 on the Raspberry and run UpdateSysroot, as far as i can see it copied the new lib to my Windows PC.

    But when i try to include the new lib in Visual Studio, it doesnt recognize the lib:

    #include and #include “bcm2835.h” doesnt work…

    What am I doing wrong??

    Many thanks in advance!

    #3258
    ket
    Participant

    Hi,

    Please use the wiringPi tutorial as a reference on how to use libraries with cross-toolchains such as the Raspberry Pi toolchain:
    http://visualgdb.com/tutorials/raspberry/wiringPi/

    The error is likely shown as the include directory has not been added to the settings, to fix this error add the include directory of the library to the include directories on the Makefile settings page in VisualGDB. Adding the include directory there will also add it to IntelliSense directories.

    #3259
    torben_pi
    Participant

    Thank you! This helped me a lot!

    To be sure… After every installed library I need to run sysroot sync – ok. Once I have added the path ‘C:SysGCCraspberryarm-linux-gnueabihfsysrootusrlocalinclude
    I then only need to specify the name of the library in the makefile settings (given that every new lib is installed in the same directory on the raspberry), is this right?

    #3260
    support
    Keymaster

    Yes, this is correct. You need to specify the library name without the extension and the ‘lib’ prefix. E.g. just ‘pthread’ for libpthread.a. This comes from the syntax of gcc’s -l command that searches for the libraries automatically using the short library names. And as the linking happens on the Windows machine, the libraries should be present there (i.e. copied during sysroot synchronization).

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.