Why simple mysql++ code compiles standalone, but not in project?

浪尽此生 提交于 2019-11-29 18:29:45

Looks like you need to edit CodeLite project settings and add these settings -lmysqlclient -lmysqlpp that you pass in command line. Fill Library Path and Libraries fields on Linker tab.

Those are linker errors.

When you create your final executable, you still must provide references to all library functions, just as you did when you compiled the single translation unit.

So, pass -lmysqlclient -lmysqlpp to g++ this time, too.

If you are using an Integrated Development Environment, configure your project's build settings accordingly. In particular, I see that CodeLite has both "Compiler" and "Linker" build settings. It's "Linker" settings that you're after.

For more information on the build process (i.e. compiling, linking and the difference), read a good C++ book.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!