The compilation process

前端 未结 5 1086
天涯浪人
天涯浪人 2021-02-03 14:17

Can anyone explain how compilation works?

I can\'t seem to figure out how compilation works..

To be more specific, here\'s an example.. I\'m trying to write some c

5条回答
  •  时光取名叫无心
    2021-02-03 14:42

    You have to go into project setting and add a directory where you have that LUA library *.lib files somewhere on the "linker" tab. Setting called "including libraries" or something, sorry I can't look it up.

    The reason you get "unresolved external symbols" is because compilation in C++ works in two stages. First, the code gets compiled, each .cpp file in it's own .obj file, then "linker" starts and join all that .obj files into .exe file. .lib file is just a bunch of .obj files merged together to make distribution of libraries just a little bit simplier. So by adding all the "#include" and extern declaration you told the compiler that somewhere it would be possible to find code with those signatures but linker can't find that code because it doesn't know where those .lib files with actual code is placed.

    Make sure you have read REDME of the library, usually they have rather detailed explanation of what you had to do to include it in your code.

提交回复
热议问题