On Windows 7, How do you reference a "static library" (a dot lib) in NetBeans

Discussion in 'Java' started by clusardi2k@aol.com, Jun 27, 2012.

  1. Guest

    I'm using Windows 7, NetBeans 7.1.2 and the C:\MinGW\bin\g++.exe compiler/linker.

    I have been trying to reference a static library (file.lib) using linker options such as "-l" and "-L". All attempts have been unsuccessful (one possible reason is) because the "-l" option only takes the name of the library (without a leading "lib" in the filename and no suffix) and probably not a path to the library file. The "L" option takes a path to the folder containing the library, but it does not work for me.

    http://mingw.org/wiki/LibraryPathHOWTO

    My question is how do you reference a static library within NetBeans?

    You can modify the project's linking options by right clicking on the project and selecting properties. From there, you can specify a library folder, a specific library file, or you can enter a specific linker option such as "-lfile".

    I have tried various ways to get my project to use the dot lib without success. When I build the project, I get a lot of undefined references.

    Thanks
    , Jun 27, 2012
    #1
    1. Advertising

  2. Re: On Windows 7, How do you reference a "static library" (a dotlib) in NetBeans

    <> wrote:
    > I'm using Windows 7, NetBeans 7.1.2 and the C:\MinGW\bin\g++.exe compiler/linker.
    > I have tried various ways to get my project to use the dot lib without success.
    > When I build the project, I get a lot of undefined references.


    Have you tried passing the full pathname of the "dot lib" as
    argument to the g++ call without any extra options? (Just an
    idle guess on my side.)

    If it works, then be happy, otherwise be aware that g++
    and "dot lib"s aren't really on topic here in a Java newsgroup.
    Andreas Leitgeb, Jun 27, 2012
    #2
    1. Advertising

  3. Arne Vajhøj Guest

    Re: On Windows 7, How do you reference a "static library" (a dotlib) in NetBeans

    On 6/27/2012 1:59 PM, wrote:
    > I'm using Windows 7, NetBeans 7.1.2 and the C:\MinGW\bin\g++.exe compiler/linker.
    >
    > I have been trying to reference a static library (file.lib) using linker options such as "-l" and "-L". All attempts have been unsuccessful (one possible reason is) because the "-l" option only takes the name of the library (without a leading "lib" in the filename and no suffix) and probably not a path to the library file. The "L" option takes a path to the folder containing the library, but it does not work for me.
    >
    > http://mingw.org/wiki/LibraryPathHOWTO
    >
    > My question is how do you reference a static library within NetBeans?
    >
    > You can modify the project's linking options by right clicking on the project and selecting properties. From there, you can specify a library folder, a specific library file, or you can enter a specific linker option such as "-lfile".
    >
    > I have tried various ways to get my project to use the dot lib without success. When I build the project, I get a lot of undefined references.


    g++ -L\foo -lbar z.cpp

    will look for \foo\libbar.a

    g++ z.cpp \foo\bar.lib

    should look for \foo\bar.lib

    Arne
    Arne Vajhøj, Jun 28, 2012
    #3
  4. Roedy Green Guest

    On Wed, 27 Jun 2012 10:59:26 -0700 (PDT), wrote,
    quoted or indirectly quoted someone who said :

    >
    >My question is how do you reference a static library within NetBeans?


    You use JNI. You have to write some Java glue code. You put all your
    C/C++ in a DLL. You use System.load or System.loadlibrary

    see http://mindprod.com/jgloss/jni.html
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    Why do so many operating systems refuse to define a standard
    temporary file marking mechanism? It could be a reserved lead character
    such as the ~ or a reserved extension such as .tmp.
    It could be a file attribute bit. Because they refuse, there is no
    fool-proof way to scan a disk for orphaned temporary files and delete them.
    Further, you can't tell where the orhaned files ame from.
    This means the hard disks gradually fill up with garbage.
    Roedy Green, Jul 8, 2012
    #4
  5. Arne Vajhøj Guest

    Re: On Windows 7, How do you reference a "static library" (a dotlib) in NetBeans

    On 7/8/2012 12:18 AM, Roedy Green wrote:
    > On Wed, 27 Jun 2012 10:59:26 -0700 (PDT), wrote,
    > quoted or indirectly quoted someone who said :
    >
    >>
    >> My question is how do you reference a static library within NetBeans?

    >
    > You use JNI. You have to write some Java glue code. You put all your
    > C/C++ in a DLL. You use System.load or System.loadlibrary


    Does that reference a static library in NetBeans??

    :)

    Arne
    Arne Vajhøj, Aug 20, 2012
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Samuël van Laere

    To dot or not to dot?

    Samuël van Laere, Oct 16, 2003, in forum: HTML
    Replies:
    8
    Views:
    414
    Samuël van Laere
    Oct 16, 2003
  2. est
    Replies:
    1
    Views:
    594
    Diez B. Roggisch
    Feb 16, 2008
  3. Replies:
    6
    Views:
    230
    Thomas 'PointedEars' Lahn
    Dec 12, 2005
  4. Chris_12345
    Replies:
    2
    Views:
    549
    Victor Bazarov
    Jun 27, 2012
  5. Arne Vajhøj
    Replies:
    0
    Views:
    265
    Arne Vajhøj
    Aug 20, 2012
Loading...

Share This Page