c-smile / sciter-sdk

Sciter is an embeddable HTML/CSS/scripting engine
http://sciter.com
Other
2.11k stars 223 forks source link

CMake doesn't find implemantation of sciter methods #227

Open koen1711 opened 1 year ago

koen1711 commented 1 year ago

Error:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: CMakeFiles/MyApp.dir/src/main.cpp.o: in function `uimain(std::function<int ()>)':
main.cpp:(.text+0x29): undefined reference to `sciter::window::window(unsigned int, tagRECT)'
/usr/bin/ld: main.cpp:(.text+0x80): undefined reference to `sciter::window::expand(bool)'
/usr/bin/ld: CMakeFiles/MyApp.dir/src/main.cpp.o: in function `sciter::host<sciter::window>::on_load_data(SCN_LOAD_DATA*)':
main.cpp:(.text._ZN6sciter4hostINS_6windowEE12on_load_dataEP13SCN_LOAD_DATA[_ZN6sciter4hostINS_6windowEE12on_load_dataEP13SCN_LOAD_DATA]+0x1b1): undefined reference to `sciter::application::hinstance()'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/MyApp.dir/build.make:101: build/MyApp] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:137: CMakeFiles/MyApp.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

CMakeLists.txt

cmake_minimum_required(VERSION 3.10)
project(example)

set(CMAKE_CXX_STANDARD 17)

include_directories(
    extern/sciter/include
    extern/gtk/include
    extern/glib/include
    extern/pango/include
    extern/harfbuzz/include
    extern/cairo
    extern/gdk-pixbuf
    extern/atk-1.0
)

add_executable(MyApp src/main.cpp)

target_link_libraries(MyApp /home/koen/Documents/GitHub/BrowserC/extern/sciter/bin.lnx/x64/libsciter-gtk.so)
target_link_libraries(MyApp /home/koen/Documents/GitHub/BrowserC/extern/sciter/bin.lnx/x64/sciter-sqlite.so)

target_link_libraries(MyApp pango-1.0)
target_link_libraries(MyApp gtk-3)
target_link_libraries(MyApp glib-2.0)
c-smile commented 1 year ago
  1. Sciter repository was moved to Gitlab
  2. You need to include https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-gtk-main.cpp source file to your project - where main() and sciter::window methods are defined.