Weird C++ library linkage issue with clion and cygwin
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
add a comment |
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
Are you completely positive theLIBSSH_FOUND
part inCMakeLists.txt
is executed? Try to inspectCMakeOutput.log
andCMakeError.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 inCmakeOutput.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: runmake VERBOSE=1
from the command line, where your projectMakefile
is located (possibly change one source file to force the build). Then, look for theld
command line in the build output.
– valiano
Jan 5 at 20:19
Okay, so after runningmake 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
add a comment |
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
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
windows-10 cygwin c++ c
edited Jan 6 at 21:51
tibovanheule
asked Jan 5 at 19:02
tibovanheuletibovanheule
134
134
Are you completely positive theLIBSSH_FOUND
part inCMakeLists.txt
is executed? Try to inspectCMakeOutput.log
andCMakeError.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 inCmakeOutput.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: runmake VERBOSE=1
from the command line, where your projectMakefile
is located (possibly change one source file to force the build). Then, look for theld
command line in the build output.
– valiano
Jan 5 at 20:19
Okay, so after runningmake 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
add a comment |
Are you completely positive theLIBSSH_FOUND
part inCMakeLists.txt
is executed? Try to inspectCMakeOutput.log
andCMakeError.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 inCmakeOutput.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: runmake VERBOSE=1
from the command line, where your projectMakefile
is located (possibly change one source file to force the build). Then, look for theld
command line in the build output.
– valiano
Jan 5 at 20:19
Okay, so after runningmake 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
add a comment |
1 Answer
1
active
oldest
votes
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 beLIBSSH_LIBRARY_DIR
, rather thanLIBSSH_INCLUDE_DIR
. - The parameter to
target_link_libraries
should beLIBSSH_LIBRARY
, rather thanLIBSSH_LIBRARIE
.
Or, alternatively:
link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")
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 getcygssh.dll
, but I think you're really looking forlibssh.a
. What if you usetarget_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")
? Or, even hard code the path tolibssh.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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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 beLIBSSH_LIBRARY_DIR
, rather thanLIBSSH_INCLUDE_DIR
. - The parameter to
target_link_libraries
should beLIBSSH_LIBRARY
, rather thanLIBSSH_LIBRARIE
.
Or, alternatively:
link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")
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 getcygssh.dll
, but I think you're really looking forlibssh.a
. What if you usetarget_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")
? Or, even hard code the path tolibssh.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
add a comment |
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 beLIBSSH_LIBRARY_DIR
, rather thanLIBSSH_INCLUDE_DIR
. - The parameter to
target_link_libraries
should beLIBSSH_LIBRARY
, rather thanLIBSSH_LIBRARIE
.
Or, alternatively:
link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")
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 getcygssh.dll
, but I think you're really looking forlibssh.a
. What if you usetarget_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")
? Or, even hard code the path tolibssh.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
add a comment |
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 beLIBSSH_LIBRARY_DIR
, rather thanLIBSSH_INCLUDE_DIR
. - The parameter to
target_link_libraries
should beLIBSSH_LIBRARY
, rather thanLIBSSH_LIBRARIE
.
Or, alternatively:
link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")
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 beLIBSSH_LIBRARY_DIR
, rather thanLIBSSH_INCLUDE_DIR
. - The parameter to
target_link_libraries
should beLIBSSH_LIBRARY
, rather thanLIBSSH_LIBRARIE
.
Or, alternatively:
link_directories(${LIBSSH_LIBRARY_DIR})
target_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")
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 getcygssh.dll
, but I think you're really looking forlibssh.a
. What if you usetarget_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")
? Or, even hard code the path tolibssh.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
add a comment |
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 getcygssh.dll
, but I think you're really looking forlibssh.a
. What if you usetarget_link_libraries(main -L${LIBSSH_LIBRARY_DIR} -lssh")
? Or, even hard code the path tolibssh.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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Are you completely positive the
LIBSSH_FOUND
part inCMakeLists.txt
is executed? Try to inspectCMakeOutput.log
andCMakeError.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 projectMakefile
is located (possibly change one source file to force the build). Then, look for theld
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