简体   繁体   中英

Trouble installing C++ libraries from Github

I've used C++ for several courses in university but the libraries we used in these courses were quite simple to install. When we came across libraries which required a bit more complex installation, our teachers always provided detailed instructions.

This time I'm doing a project on my own. I have downloaded libraries for my own projects in the past. Sometimes the install was easier, sometimes I had to search for hours to do things most people here would do in 5 minutes.

I did some studying to remember some stuff about the compiling process, what dynamic and static libraries are, etc. I feel I understand the most part but it didn't really help me with my efforts to install some libraries. Some people in Github provide instructions for newbies like me, but others, understandably, don't.

I'm saying a lot so I'll get to the point. I will provide links for the library I'm trying to install but in case I'm not allowed to, please let me know so I can rewrite this in a way that is allowed.

I'm trying to install libccd so I can then install fcl . In the instructions 3 ways are mentioned:

  • Using Makefile
  • Using autotools
  • Using Cmake

In all 3 methods, I see specific commands like this:

安装说明中构建命令的屏幕截图

First of all, where am I supposed to write these commands?

I don't even know how to search this. So, I tried installing with methods I've previously used. Here are the steps I took:

  • Downloaded the whole repository.
  • Made a solution for Visual Studio with Cmake-gui (that's all I know how to do with Cmake,unfortunately it usually was enough so I never learnt more)
  • Compiled the code in Release mode, which should give me a lib file.
  • Now,in my own project, I added the relevant include directories of the repository I downloaded and the library directory for the lib file which was produced.

I'm not sure about my last step. I'm pretty sure if I did the installation as proposed in the link(and as required by fcl), I would have a new folder for the library including just an include folder and a lib folder. Now I'm just searching for the correct include files and the lib file in subfolders of subfolders hoping I include the right ones. I'm a bit lost.

I'd really like some general steps(if there are) to installing a library. I know each library has its own ways but I assume the general idea with Cmake or Makefile should be the same. I have tried searching online but I didn't come across a good or detailed enough tutorial. I really don't wanna waste any more days trying to install libraries and I don't want to end up asking here again.

UPDATE:

It looks like there is no standard way to install libraries. Since I'm getting 'close votes' I'll include a specific question:

Are the steps I took correct? What should I do next?

I'm trying to install libccd so I can then install fcl. In the instructions 3 ways are mentioned:

  • Using Makefile
  • Using autotools
  • Using Cmake

In all 3 methods, I see specific commands like this:

安装说明中构建命令的屏幕截图

First of all, where am I supposed to write these commands?

These instructions are for a UNIX-like system. Makefiles, autotools... these are UNIX things. You'd typically write those build commands into a console window on something like Linux or a Mac.

CMake is a bit more cross-platform. You can find out how to invoke CMake on other SO questions .

You can get Makefiles and such to work on Windows, using projects like Cygwin and MSYS. I'd generally recommend you avoid that unless you really need it.

I'm not sure about my last step. I'm pretty sure if I did the installation as proposed in the link(and as required by fcl), I would have a new folder for the library including just an include folder and a lib folder. Now I'm just searching for the correct include files and the lib file in subfolders of subfolders hoping I include the right ones. I'm a bit lost.

This is where no "general" advice exists. Different authors put their output in different places. If their instructions didn't include this information, you're already doing the right thing. If you get really stuck, you can always just ask them .

I'd really like some general steps(if there are) to installing a library.

No such thing exists, but where these industry-standard tools are involved, you can usually go on general documentation for those tools, or from memory.

I also suggest you shop around for a general book on programming, as general principles should be covered in any good one of those.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM