问题描述
一个简单的问题-在编译期间这些方法是否不必调用库?我的意思是,我只想简单地调用g ++ main.cpp而不调用g ++ main.cpp -lGL -lGLU -lGLEW -lSTL -lMyMother等...我知道,makefile文件或简单的shell脚本,但是我想优雅的方式-在cpp代码中调用这些库-类似于使用GL;".
Simple question- are these any way to not have to call libraries during the compiling? I mean, I would like to simply call g++ main.cpp without calling g++ main.cpp -lGL -lGLU -lGLEW -lSTL -lMyMother and so on... I know, makefiles or simple shell scripting, but I would like to make it elegant way - call these libraries inside cpp code - something like 'using GL;'.
推荐答案
由于使用的是GCC,因此您可以创建/修改规范文件以添加所需的标志.
Since you're using GCC, you could create/modify a specs file to add the flags you want.
但是,如果您不喜欢输入标志,则确实应该使用makefile.
If you don't like typing flags, you really should be using a makefile, though.
这篇关于g ++:不带-l标志进行编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!