我在路径mylib.a
中有一个名为/home/test/libs/
的库。
如何将其添加到项目中?
find_library(IDA_LIB
NAMES "mylib.a"
PATHS "/home/test/libs"
NO_DEFAULT_PATH)
由于它没有前缀lib
,因此cmake找不到它。如果我将库名改为libmylib.a
,如果发现它没问题。
谢谢!
答案 0 :(得分:2)
将以下命令与库的绝对文件路径一起使用
var howM = prompt("How many cards?")
var arr = [];
for(var i = 0; i < parseInt(howM); i++)
arr.push(prompt("Enter a card:")); //No curly braces is fine when its a single line. When there's no braces, JS just runs the next line x amount of times
console.log(arr)
var sum = 0; //Create sum out here. Setting it to zero every loop defeats the purpose
for(var i = 0; i < arr.length; i++)//You said "i <= howM". Better to use the length of the array that is being looped through
{ //Use curly braces to show what code to execute repeatedly
var eXt = arr[i]; //Set eXt to the current number
eXt = eXt.replace("-", ""); //No need for regex
sum += parseInt(eXt); //Convert the input to a number, then add it to sum
}
console.log(sum);
答案 1 :(得分:0)
尝试一下:
add_library(mylib STATIC IMPORTED)
set_target_properties(mylib PROPERTIES IMPORTED_LOCATION /home/test/mylib.a)
然后您可以在以下位置使用“ mylib”:
target_link_libraries(myapp
mylib )