Quantcast

Why are my static libs not being read?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Why are my static libs not being read?

Toronto Andrew
The qt libraries are included in the target link flag (this project uses qt of course), however the two lib files that exist in the lib folder in the same directory are either not recognized. They draw up linker issues in the compiler, even though I can tell through the cmake gui that it does find those paths.

Any input at all would be great. Below I have included the CMakeLists.txt, a screenshot of the cmake gui as well as a sample of the linking errors being drawn.

PROJECT(CppSampleQt01)
FIND_PACKAGE(Qt4 REQUIRED)

//These are the lines I am concerned do not function appropriately. However you can see here that they are recognized by CMake
FIND_LIBRARY(SIMPLONLIB lv.simplon lib)
FIND_LIBRARY(SIMPLONIMGPROC lv.simplon.imgproc lib)

SET(CppSampleQt01_SOURCES include/lv.simplon.class.cpp camera.cpp main.cpp mainwindow.cpp osdep.cpp paint.cpp)
SET(CppSampleQt01_HEADERS include/lv.simplon.class.h camera.h mainwindow.h osdep.h paint.h)
SET(CppSampleQt01_RESOURCES icons.qrc)

INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})

ADD_EXECUTABLE(CppSampleQt01 ${CppSampleQt01_SOURCES}
                                ${CppSampleQt01_HEADERS_MOC}
                                ${CppSampleQt01_RESOURCES_RCC})

TARGET_LINK_LIBRARIES(CppSampleQt01 ${QT_LIBRARIES})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} include QExtSerialPort/src)

And here are some of the relevant linker errors that are drawn:

2>lv.simplon.class.obj : error LNK2019: unresolved external symbol __imp__LvEventKill@4 referenced in function "public: unsigned int __thiscall LvEvent::Kill(void)" (?Kill@LvEvent@@QAEIXZ)
2>lv.simplon.class.obj : error LNK2019: unresolved external symbol __imp__LvEventFlush@4 referenced in function "public: unsigned int __thiscall LvEvent::Flush(void)" (?Flush@LvEvent@@QAEIXZ).......
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Why are my static libs not being read?

John Drescher-2
> The qt libraries are included in the target link flag (this project uses qt
> of course), however the two lib files that exist in the lib folder in the
> same directory are either not recognized. They draw up linker issues in the
> compiler, even though I can tell through the cmake gui that it does find
> those paths.
>
> Any input at all would be great. Below I have included the CMakeLists.txt, a
> screenshot of the cmake gui as well as a sample of the linking errors being
> drawn.
>
> PROJECT(CppSampleQt01)
> FIND_PACKAGE(Qt4 REQUIRED)
>
> //These are the lines I am concerned do not function appropriately. However
> you can  http://i.imgur.com/EDrHR.png see here  that they are recognized by
> CMake
> FIND_LIBRARY(SIMPLONLIB lv.simplon lib)
> FIND_LIBRARY(SIMPLONIMGPROC lv.simplon.imgproc lib)
>
> SET(CppSampleQt01_SOURCES include/lv.simplon.class.cpp camera.cpp main.cpp
> mainwindow.cpp osdep.cpp paint.cpp)
> SET(CppSampleQt01_HEADERS include/lv.simplon.class.h camera.h mainwindow.h
> osdep.h paint.h)
> SET(CppSampleQt01_RESOURCES icons.qrc)
>
> INCLUDE(${QT_USE_FILE})
> ADD_DEFINITIONS(${QT_DEFINITIONS})
>
> ADD_EXECUTABLE(CppSampleQt01 ${CppSampleQt01_SOURCES}
>                                 ${CppSampleQt01_HEADERS_MOC}
>                                 ${CppSampleQt01_RESOURCES_RCC})
>
> TARGET_LINK_LIBRARIES(CppSampleQt01 ${QT_LIBRARIES})

You need to add your 2 libraries in TARGET_LINK_LIBRARIES. CMake will
not do that automatically.

John
--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Why are my static libs not being read?

Toronto Andrew
Include it using the flags? Like so:


TARGET_LINK_LIBRARIES(CppSampleQt01 ${QT_LIBRARIES} SIMPLONLIB SIMPLONIMGPROC) ?

Because when I did this, the libs were not found either.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Why are my static libs not being read?

John Drescher-2
On Tue, Jul 31, 2012 at 2:21 PM, Toronto Andrew
<[hidden email]> wrote:
> Include it using the flags? Like so:
>
>
> TARGET_LINK_LIBRARIES(CppSampleQt01 ${QT_LIBRARIES} SIMPLONLIB
> SIMPLONIMGPROC) ?
>
> Because when I did this, the libs were not found either.
>

I think it should be:

TARGET_LINK_LIBRARIES(CppSampleQt01 ${QT_LIBRARIES} ${SIMPLONLIB}
${SIMPLONIMGPROC})

since both of these should be variables.




John
--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Why are my static libs not being read?

Toronto Andrew
This post was updated on .
Thank you John, this did work. I get the idea now, thank you.

I have another concern though, that I hope I can be helped with though it's doesn't fall under the original problem.

So I am using a project within my project: http://i.imgur.com/bqqnp.png, and I found a custom CMakeLists.txt for it created by the developers, and I was wondering how would I go about integrating that into my existing CMakeLists.txt, any input regarding how to go about doing this will be greatly appreciated.

Thank you guys once again!

EDIT: I feel like this needs clarification if anyone is willing to take a look at it. The project being included is a Qt library of sorts. I am just curious as whether to put it under the CppSampleQt01 sources, or if there is a better way of structuring it such that it matches the nesting structure presented in the IDE
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Why are my static libs not being read?

John Drescher-2
On Tue, Jul 31, 2012 at 2:54 PM, Toronto Andrew
<[hidden email]> wrote:

> Thank you John, this did work. I get the idea now, thank you.
>
> I have another concern though, that I hope I can be helped with though it's
> doesn't fall under the original problem.
>
> So I am using a project within my project: http://i.imgur.com/bqqnp.png, and
> I found a custom
> https://qextserialport.googlegroups.com/attach/9b25d0e5e8974d99/CMakeLists.txt?view=1&part=4
> CMakeLists.txt  for it created by the developers, and I was wondering how
> would I go about integrating that into my existing CMakeLists.txt, any input
> regarding how to go about doing this will be greatly appreciated.
>
> Thank you guys once again!
>

One way is to put this file along with the sources in a subdirectory
of your project and use the add_subdirectory cmake command to add that
to your project. Then add qextserialport to your
TARGET_LINK_LIBRARIES. This time just use qextserialport since it is
not a variable but a target. You will also have to add a entry to your
include_directories for the location of the .h file in this
subdirectory.

John
--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Loading...