How do I set up the linking order in code blocks?

2019-08-27 01:08发布

问题:

I tried to run a program on opencv but got the following error:

test_1.cpp:(.text+0x44): undefined reference to `cv::imread(std::basic_string<char,    
std::char_traits<char>, std::allocator<char> > const&, int)'

I learnt that the order of sources and libraries on the link line matters

So, running g++ -o test_1 test_1.cpppkg-config opencv --cflags --libs works.

However, how can I setup code blocks so that when I build the code, it applies the correct order?