Fixed Cmake issues, modified code to compile and link without errors