Weird C++ library linkage issue with clion and cygwin












2















I have the following error when trying to compile a c++ program while linking the library Libssh on Windows (packages libssh-common and libssh-devel both installed with cygwin). Clion doesn't give me an include error and cmake finds the library during the Cmake reload of Clion, but when compiling/linking it complains that the references are undefined.



Could someone point out my stupid mistake?
Thanks in advance!



Scanning dependencies of target main
[ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
[100%] Linking CXX executable main.exe
CMakeFiles/main.dir/main.cpp.o:main.cpp:(.text+0x30): undefined reference to `ssh_new'
CMakeFiles/main.dir/main.cpp.o:main.cpp:(.text+0x30): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `ssh_new'
collect2: error: ld returned 1 exit status


my CmakeLisst.txt



add_executable(main main.cpp)
find_package(LIBSSH)
IF (LIBSSH_FOUND)
message(${LIBSSH_VERSION})
include_directories(${LIBSSH_INCLUDE_DIR})
link_directories(${LIBSSH_INCLUDE_DIR})
target_link_libraries(main ${LIBSSH_LIBRARIE})
endif ()


output Cmake reload



C:Usersseven.CLion2018.3systemcygwin_cmakebincmake.exe -DCMAKE_BUILD_TYPE= -DCMAKE_MAKE_PROGRAM=C:/cygwin64/bin/make.exe -DCMAKE_C_COMPILER=C:/cygwin64/bin/gcc.exe -DCMAKE_CXX_COMPILER=C:/cygwin64/bin/g++.exe -G "CodeBlocks - Unix Makefiles" "/cygdrive/c/Users/seven/Documents/github/Server control"
0.7.5
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/c/Users/seven/Documents/github/Server control/cmake-build-default-cygwin

[Finished]


main.cpp



#include <stdlib.h>
#include <iostream>
#define LIBSSH_STATIC 1
#include <libsshlibssh.h>

int main() {
std::cout << "Hello world" << std::endl;
ssh_session my_ssh_session = ssh_new();
return 0;
}


--update 1--
CmakeOutput.log
github gist



--SOLUTION----



Had to change my cmakelist to the following



find_package(LIBSSH)
IF (LIBSSH_FOUND)
message(${LIBSSH_VERSION})
include_directories(${LIBSSH_INCLUDE_DIR})
link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY} -lssh)
endif ()









share|improve this question

























  • Are you completely positive the LIBSSH_FOUND part in CMakeLists.txt is executed? Try to inspect CMakeOutput.log and CMakeError.log for making sure and possible helpful hints

    – valiano
    Jan 5 at 19:31






  • 1





    @valiano Well, it manages to print out the correct version number, so I thought the block executed. I tried to find CMakeError.log but it isn't present in my project files. I don't find any weird entries in CmakeOutput.log but I find nothing about libssh either. I will give a github gist

    – tibovanheule
    Jan 5 at 20:02













  • Thanks for the gist Tibo_Vanheule. It's difficult for me to say whether libssh is indeed picked. You can check whether it's actually linked against with: run make VERBOSE=1 from the command line, where your project Makefile is located (possibly change one source file to force the build). Then, look for the ld command line in the build output.

    – valiano
    Jan 5 at 20:19











  • Okay, so after running make VERBSOE=1. I looked in the output and didn't found the ld command. make verbose output .Thanks for the answer!

    – tibovanheule
    Jan 5 at 21:13
















2















I have the following error when trying to compile a c++ program while linking the library Libssh on Windows (packages libssh-common and libssh-devel both installed with cygwin). Clion doesn't give me an include error and cmake finds the library during the Cmake reload of Clion, but when compiling/linking it complains that the references are undefined.



Could someone point out my stupid mistake?
Thanks in advance!



Scanning dependencies of target main
[ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
[100%] Linking CXX executable main.exe
CMakeFiles/main.dir/main.cpp.o:main.cpp:(.text+0x30): undefined reference to `ssh_new'
CMakeFiles/main.dir/main.cpp.o:main.cpp:(.text+0x30): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `ssh_new'
collect2: error: ld returned 1 exit status


my CmakeLisst.txt



add_executable(main main.cpp)
find_package(LIBSSH)
IF (LIBSSH_FOUND)
message(${LIBSSH_VERSION})
include_directories(${LIBSSH_INCLUDE_DIR})
link_directories(${LIBSSH_INCLUDE_DIR})
target_link_libraries(main ${LIBSSH_LIBRARIE})
endif ()


output Cmake reload



C:Usersseven.CLion2018.3systemcygwin_cmakebincmake.exe -DCMAKE_BUILD_TYPE= -DCMAKE_MAKE_PROGRAM=C:/cygwin64/bin/make.exe -DCMAKE_C_COMPILER=C:/cygwin64/bin/gcc.exe -DCMAKE_CXX_COMPILER=C:/cygwin64/bin/g++.exe -G "CodeBlocks - Unix Makefiles" "/cygdrive/c/Users/seven/Documents/github/Server control"
0.7.5
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/c/Users/seven/Documents/github/Server control/cmake-build-default-cygwin

[Finished]


main.cpp



#include <stdlib.h>
#include <iostream>
#define LIBSSH_STATIC 1
#include <libsshlibssh.h>

int main() {
std::cout << "Hello world" << std::endl;
ssh_session my_ssh_session = ssh_new();
return 0;
}


--update 1--
CmakeOutput.log
github gist



--SOLUTION----



Had to change my cmakelist to the following



find_package(LIBSSH)
IF (LIBSSH_FOUND)
message(${LIBSSH_VERSION})
include_directories(${LIBSSH_INCLUDE_DIR})
link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY} -lssh)
endif ()









share|improve this question

























  • Are you completely positive the LIBSSH_FOUND part in CMakeLists.txt is executed? Try to inspect CMakeOutput.log and CMakeError.log for making sure and possible helpful hints

    – valiano
    Jan 5 at 19:31






  • 1





    @valiano Well, it manages to print out the correct version number, so I thought the block executed. I tried to find CMakeError.log but it isn't present in my project files. I don't find any weird entries in CmakeOutput.log but I find nothing about libssh either. I will give a github gist

    – tibovanheule
    Jan 5 at 20:02













  • Thanks for the gist Tibo_Vanheule. It's difficult for me to say whether libssh is indeed picked. You can check whether it's actually linked against with: run make VERBOSE=1 from the command line, where your project Makefile is located (possibly change one source file to force the build). Then, look for the ld command line in the build output.

    – valiano
    Jan 5 at 20:19











  • Okay, so after running make VERBSOE=1. I looked in the output and didn't found the ld command. make verbose output .Thanks for the answer!

    – tibovanheule
    Jan 5 at 21:13














2












2








2


1






I have the following error when trying to compile a c++ program while linking the library Libssh on Windows (packages libssh-common and libssh-devel both installed with cygwin). Clion doesn't give me an include error and cmake finds the library during the Cmake reload of Clion, but when compiling/linking it complains that the references are undefined.



Could someone point out my stupid mistake?
Thanks in advance!



Scanning dependencies of target main
[ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
[100%] Linking CXX executable main.exe
CMakeFiles/main.dir/main.cpp.o:main.cpp:(.text+0x30): undefined reference to `ssh_new'
CMakeFiles/main.dir/main.cpp.o:main.cpp:(.text+0x30): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `ssh_new'
collect2: error: ld returned 1 exit status


my CmakeLisst.txt



add_executable(main main.cpp)
find_package(LIBSSH)
IF (LIBSSH_FOUND)
message(${LIBSSH_VERSION})
include_directories(${LIBSSH_INCLUDE_DIR})
link_directories(${LIBSSH_INCLUDE_DIR})
target_link_libraries(main ${LIBSSH_LIBRARIE})
endif ()


output Cmake reload



C:Usersseven.CLion2018.3systemcygwin_cmakebincmake.exe -DCMAKE_BUILD_TYPE= -DCMAKE_MAKE_PROGRAM=C:/cygwin64/bin/make.exe -DCMAKE_C_COMPILER=C:/cygwin64/bin/gcc.exe -DCMAKE_CXX_COMPILER=C:/cygwin64/bin/g++.exe -G "CodeBlocks - Unix Makefiles" "/cygdrive/c/Users/seven/Documents/github/Server control"
0.7.5
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/c/Users/seven/Documents/github/Server control/cmake-build-default-cygwin

[Finished]


main.cpp



#include <stdlib.h>
#include <iostream>
#define LIBSSH_STATIC 1
#include <libsshlibssh.h>

int main() {
std::cout << "Hello world" << std::endl;
ssh_session my_ssh_session = ssh_new();
return 0;
}


--update 1--
CmakeOutput.log
github gist



--SOLUTION----



Had to change my cmakelist to the following



find_package(LIBSSH)
IF (LIBSSH_FOUND)
message(${LIBSSH_VERSION})
include_directories(${LIBSSH_INCLUDE_DIR})
link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY} -lssh)
endif ()









share|improve this question
















I have the following error when trying to compile a c++ program while linking the library Libssh on Windows (packages libssh-common and libssh-devel both installed with cygwin). Clion doesn't give me an include error and cmake finds the library during the Cmake reload of Clion, but when compiling/linking it complains that the references are undefined.



Could someone point out my stupid mistake?
Thanks in advance!



Scanning dependencies of target main
[ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
[100%] Linking CXX executable main.exe
CMakeFiles/main.dir/main.cpp.o:main.cpp:(.text+0x30): undefined reference to `ssh_new'
CMakeFiles/main.dir/main.cpp.o:main.cpp:(.text+0x30): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `ssh_new'
collect2: error: ld returned 1 exit status


my CmakeLisst.txt



add_executable(main main.cpp)
find_package(LIBSSH)
IF (LIBSSH_FOUND)
message(${LIBSSH_VERSION})
include_directories(${LIBSSH_INCLUDE_DIR})
link_directories(${LIBSSH_INCLUDE_DIR})
target_link_libraries(main ${LIBSSH_LIBRARIE})
endif ()


output Cmake reload



C:Usersseven.CLion2018.3systemcygwin_cmakebincmake.exe -DCMAKE_BUILD_TYPE= -DCMAKE_MAKE_PROGRAM=C:/cygwin64/bin/make.exe -DCMAKE_C_COMPILER=C:/cygwin64/bin/gcc.exe -DCMAKE_CXX_COMPILER=C:/cygwin64/bin/g++.exe -G "CodeBlocks - Unix Makefiles" "/cygdrive/c/Users/seven/Documents/github/Server control"
0.7.5
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/c/Users/seven/Documents/github/Server control/cmake-build-default-cygwin

[Finished]


main.cpp



#include <stdlib.h>
#include <iostream>
#define LIBSSH_STATIC 1
#include <libsshlibssh.h>

int main() {
std::cout << "Hello world" << std::endl;
ssh_session my_ssh_session = ssh_new();
return 0;
}


--update 1--
CmakeOutput.log
github gist



--SOLUTION----



Had to change my cmakelist to the following



find_package(LIBSSH)
IF (LIBSSH_FOUND)
message(${LIBSSH_VERSION})
include_directories(${LIBSSH_INCLUDE_DIR})
link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY} -lssh)
endif ()






windows-10 cygwin c++ c






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 6 at 21:51







tibovanheule

















asked Jan 5 at 19:02









tibovanheuletibovanheule

134




134













  • Are you completely positive the LIBSSH_FOUND part in CMakeLists.txt is executed? Try to inspect CMakeOutput.log and CMakeError.log for making sure and possible helpful hints

    – valiano
    Jan 5 at 19:31






  • 1





    @valiano Well, it manages to print out the correct version number, so I thought the block executed. I tried to find CMakeError.log but it isn't present in my project files. I don't find any weird entries in CmakeOutput.log but I find nothing about libssh either. I will give a github gist

    – tibovanheule
    Jan 5 at 20:02













  • Thanks for the gist Tibo_Vanheule. It's difficult for me to say whether libssh is indeed picked. You can check whether it's actually linked against with: run make VERBOSE=1 from the command line, where your project Makefile is located (possibly change one source file to force the build). Then, look for the ld command line in the build output.

    – valiano
    Jan 5 at 20:19











  • Okay, so after running make VERBSOE=1. I looked in the output and didn't found the ld command. make verbose output .Thanks for the answer!

    – tibovanheule
    Jan 5 at 21:13



















  • Are you completely positive the LIBSSH_FOUND part in CMakeLists.txt is executed? Try to inspect CMakeOutput.log and CMakeError.log for making sure and possible helpful hints

    – valiano
    Jan 5 at 19:31






  • 1





    @valiano Well, it manages to print out the correct version number, so I thought the block executed. I tried to find CMakeError.log but it isn't present in my project files. I don't find any weird entries in CmakeOutput.log but I find nothing about libssh either. I will give a github gist

    – tibovanheule
    Jan 5 at 20:02













  • Thanks for the gist Tibo_Vanheule. It's difficult for me to say whether libssh is indeed picked. You can check whether it's actually linked against with: run make VERBOSE=1 from the command line, where your project Makefile is located (possibly change one source file to force the build). Then, look for the ld command line in the build output.

    – valiano
    Jan 5 at 20:19











  • Okay, so after running make VERBSOE=1. I looked in the output and didn't found the ld command. make verbose output .Thanks for the answer!

    – tibovanheule
    Jan 5 at 21:13

















Are you completely positive the LIBSSH_FOUND part in CMakeLists.txt is executed? Try to inspect CMakeOutput.log and CMakeError.log for making sure and possible helpful hints

– valiano
Jan 5 at 19:31





Are you completely positive the LIBSSH_FOUND part in CMakeLists.txt is executed? Try to inspect CMakeOutput.log and CMakeError.log for making sure and possible helpful hints

– valiano
Jan 5 at 19:31




1




1





@valiano Well, it manages to print out the correct version number, so I thought the block executed. I tried to find CMakeError.log but it isn't present in my project files. I don't find any weird entries in CmakeOutput.log but I find nothing about libssh either. I will give a github gist

– tibovanheule
Jan 5 at 20:02







@valiano Well, it manages to print out the correct version number, so I thought the block executed. I tried to find CMakeError.log but it isn't present in my project files. I don't find any weird entries in CmakeOutput.log but I find nothing about libssh either. I will give a github gist

– tibovanheule
Jan 5 at 20:02















Thanks for the gist Tibo_Vanheule. It's difficult for me to say whether libssh is indeed picked. You can check whether it's actually linked against with: run make VERBOSE=1 from the command line, where your project Makefile is located (possibly change one source file to force the build). Then, look for the ld command line in the build output.

– valiano
Jan 5 at 20:19





Thanks for the gist Tibo_Vanheule. It's difficult for me to say whether libssh is indeed picked. You can check whether it's actually linked against with: run make VERBOSE=1 from the command line, where your project Makefile is located (possibly change one source file to force the build). Then, look for the ld command line in the build output.

– valiano
Jan 5 at 20:19













Okay, so after running make VERBSOE=1. I looked in the output and didn't found the ld command. make verbose output .Thanks for the answer!

– tibovanheule
Jan 5 at 21:13





Okay, so after running make VERBSOE=1. I looked in the output and didn't found the ld command. make verbose output .Thanks for the answer!

– tibovanheule
Jan 5 at 21:13










1 Answer
1






active

oldest

votes


















0














Judging from make VEBOSE=1 output, the libssh library is indeed not linked against.



Try fixing these lines in your CMakeLists.txt:



link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main ${LIBSSH_LIBRARY})



  • The parameter to link_directories should be LIBSSH_LIBRARY_DIR, rather than LIBSSH_INCLUDE_DIR.

  • The parameter to target_link_libraries should be LIBSSH_LIBRARY, rather than LIBSSH_LIBRARIE.


Or, alternatively:



link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")





share|improve this answer


























  • Thank you, it fixes the link, but gave new error, sadly! make[2]: *** No rule to make target '/usr/lib/cygssh.dll', needed by 'main.exe'. Stop. new verbose gist and yes i installed all openssh related packages

    – tibovanheule
    Jan 6 at 15:24













  • Hmm... You get cygssh.dll, but I think you're really looking for libssh.a. What if you use target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")? Or, even hard code the path to libssh.a, if nothing else works.

    – valiano
    Jan 6 at 19:05













  • It now compiles perfectly, Thank you very much for helping me!

    – tibovanheule
    Jan 6 at 21:50











  • @tibovanheule gladly!

    – valiano
    Jan 7 at 6:33











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1390964%2fweird-c-library-linkage-issue-with-clion-and-cygwin%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Judging from make VEBOSE=1 output, the libssh library is indeed not linked against.



Try fixing these lines in your CMakeLists.txt:



link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main ${LIBSSH_LIBRARY})



  • The parameter to link_directories should be LIBSSH_LIBRARY_DIR, rather than LIBSSH_INCLUDE_DIR.

  • The parameter to target_link_libraries should be LIBSSH_LIBRARY, rather than LIBSSH_LIBRARIE.


Or, alternatively:



link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")





share|improve this answer


























  • Thank you, it fixes the link, but gave new error, sadly! make[2]: *** No rule to make target '/usr/lib/cygssh.dll', needed by 'main.exe'. Stop. new verbose gist and yes i installed all openssh related packages

    – tibovanheule
    Jan 6 at 15:24













  • Hmm... You get cygssh.dll, but I think you're really looking for libssh.a. What if you use target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")? Or, even hard code the path to libssh.a, if nothing else works.

    – valiano
    Jan 6 at 19:05













  • It now compiles perfectly, Thank you very much for helping me!

    – tibovanheule
    Jan 6 at 21:50











  • @tibovanheule gladly!

    – valiano
    Jan 7 at 6:33
















0














Judging from make VEBOSE=1 output, the libssh library is indeed not linked against.



Try fixing these lines in your CMakeLists.txt:



link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main ${LIBSSH_LIBRARY})



  • The parameter to link_directories should be LIBSSH_LIBRARY_DIR, rather than LIBSSH_INCLUDE_DIR.

  • The parameter to target_link_libraries should be LIBSSH_LIBRARY, rather than LIBSSH_LIBRARIE.


Or, alternatively:



link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")





share|improve this answer


























  • Thank you, it fixes the link, but gave new error, sadly! make[2]: *** No rule to make target '/usr/lib/cygssh.dll', needed by 'main.exe'. Stop. new verbose gist and yes i installed all openssh related packages

    – tibovanheule
    Jan 6 at 15:24













  • Hmm... You get cygssh.dll, but I think you're really looking for libssh.a. What if you use target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")? Or, even hard code the path to libssh.a, if nothing else works.

    – valiano
    Jan 6 at 19:05













  • It now compiles perfectly, Thank you very much for helping me!

    – tibovanheule
    Jan 6 at 21:50











  • @tibovanheule gladly!

    – valiano
    Jan 7 at 6:33














0












0








0







Judging from make VEBOSE=1 output, the libssh library is indeed not linked against.



Try fixing these lines in your CMakeLists.txt:



link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main ${LIBSSH_LIBRARY})



  • The parameter to link_directories should be LIBSSH_LIBRARY_DIR, rather than LIBSSH_INCLUDE_DIR.

  • The parameter to target_link_libraries should be LIBSSH_LIBRARY, rather than LIBSSH_LIBRARIE.


Or, alternatively:



link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")





share|improve this answer















Judging from make VEBOSE=1 output, the libssh library is indeed not linked against.



Try fixing these lines in your CMakeLists.txt:



link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main ${LIBSSH_LIBRARY})



  • The parameter to link_directories should be LIBSSH_LIBRARY_DIR, rather than LIBSSH_INCLUDE_DIR.

  • The parameter to target_link_libraries should be LIBSSH_LIBRARY, rather than LIBSSH_LIBRARIE.


Or, alternatively:



link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")






share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 7 at 6:35

























answered Jan 6 at 7:43









valianovaliano

204110




204110













  • Thank you, it fixes the link, but gave new error, sadly! make[2]: *** No rule to make target '/usr/lib/cygssh.dll', needed by 'main.exe'. Stop. new verbose gist and yes i installed all openssh related packages

    – tibovanheule
    Jan 6 at 15:24













  • Hmm... You get cygssh.dll, but I think you're really looking for libssh.a. What if you use target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")? Or, even hard code the path to libssh.a, if nothing else works.

    – valiano
    Jan 6 at 19:05













  • It now compiles perfectly, Thank you very much for helping me!

    – tibovanheule
    Jan 6 at 21:50











  • @tibovanheule gladly!

    – valiano
    Jan 7 at 6:33



















  • Thank you, it fixes the link, but gave new error, sadly! make[2]: *** No rule to make target '/usr/lib/cygssh.dll', needed by 'main.exe'. Stop. new verbose gist and yes i installed all openssh related packages

    – tibovanheule
    Jan 6 at 15:24













  • Hmm... You get cygssh.dll, but I think you're really looking for libssh.a. What if you use target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")? Or, even hard code the path to libssh.a, if nothing else works.

    – valiano
    Jan 6 at 19:05













  • It now compiles perfectly, Thank you very much for helping me!

    – tibovanheule
    Jan 6 at 21:50











  • @tibovanheule gladly!

    – valiano
    Jan 7 at 6:33

















Thank you, it fixes the link, but gave new error, sadly! make[2]: *** No rule to make target '/usr/lib/cygssh.dll', needed by 'main.exe'. Stop. new verbose gist and yes i installed all openssh related packages

– tibovanheule
Jan 6 at 15:24







Thank you, it fixes the link, but gave new error, sadly! make[2]: *** No rule to make target '/usr/lib/cygssh.dll', needed by 'main.exe'. Stop. new verbose gist and yes i installed all openssh related packages

– tibovanheule
Jan 6 at 15:24















Hmm... You get cygssh.dll, but I think you're really looking for libssh.a. What if you use target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")? Or, even hard code the path to libssh.a, if nothing else works.

– valiano
Jan 6 at 19:05







Hmm... You get cygssh.dll, but I think you're really looking for libssh.a. What if you use target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")? Or, even hard code the path to libssh.a, if nothing else works.

– valiano
Jan 6 at 19:05















It now compiles perfectly, Thank you very much for helping me!

– tibovanheule
Jan 6 at 21:50





It now compiles perfectly, Thank you very much for helping me!

– tibovanheule
Jan 6 at 21:50













@tibovanheule gladly!

– valiano
Jan 7 at 6:33





@tibovanheule gladly!

– valiano
Jan 7 at 6:33


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1390964%2fweird-c-library-linkage-issue-with-clion-and-cygwin%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How do I know what Microsoft account the skydrive app is syncing to?

When does type information flow backwards in C++?

Grease: Live!