undefined reference to function declared in *.h file

后端 未结 4 802
挽巷
挽巷 2020-12-10 16:41

I am a unskilled programmer and new to linux, I run into a problem when complining. I have two files \'ex_addinst.c\' and \'lindo.h\' in the same folder, I input command :

4条回答
  •  醉话见心
    2020-12-10 17:21

    undefined reference to ... is not a declaration problem. The compiler fails because it can't find symbols (objects) which are related to those declared functions.
    In your case, you use the Limbo API, and include the header file, but you don't tell the compiler to link with the library : that's why it doesn't find symbols.
    EDIT : I had forgotten the part when you say you're new to Linux. To link with the library, you need to use the -L/-l options of g++. man g++ is always a good read, and the Limbo's documentation should be, too.

提交回复
热议问题