g++

Creating my own makefile [Error 255]

佐手、 提交于 2019-12-23 02:55:15
问题 I have been enjoying the luxury of coding with an IDE that writes my makefile's for me, Iv decided that I have been 'short cutting' for far to long, so I have read a few manuals and watched a few videos on makefiles and have a makefile semi-done, the only trouble that I'm having is I'm not sure how to link libraries. CPPS := $(shell ls src/*cpp) TEMP := $(subst src/,obj/,$(CPPS)) OBJS := $(subst .cpp,.o,$(TEMP)) HEADERS := $(shell ls inc/*.h) EXEC := bin/testfile all: $(EXEC) $(EXEC) : $(OBJS

cc1plus: unrecognized command line option warning on any other warning

亡梦爱人 提交于 2019-12-23 02:38:35
问题 I have a strange behavior of g++ that it shows a warning about unrecognized command line option, when any other warning is shown. Example: struct Foo{virtual int bar() = 0;}; struct Bar:public Foo{int bar() {return 0;} }; int main(){} Compiling with g++-5 -Wsuggest-override -Wno-c99-extensions -std=c++11 a.cpp or even g++-5 -Wsuggest-override -Wno-c99-extensions a.cpp shows: a.cpp:2:27: warning: ‘virtual int Bar::bar()’ can be marked override [-Wsuggest-override] struct Bar:public Foo{int bar

C++ Non-Integral template Const Initialization expected init-declarator before ClassName

会有一股神秘感。 提交于 2019-12-23 02:26:13
问题 I am trying to Initialize a Non-Integral template Constant. Please find below the code: #ifndef _EXETENDED_CLASS_H #define _EXETENDED_CLASS_H template<class T> class BaseClass { public: BaseClass(); ~BaseClass(); }; template <class T> BaseClass<T>::BaseClass() {} template <class T> BaseClass<T>::~BaseClass() {} template<class T> class ExtendedClass:public BaseClass<T> { public: typedef ExtendedClass<T>* position; static const position NULLPOSITION; ExtendedClass(); ~ExtendedClass(); private:

How to force ld to use a static lib instead of shared lib?

一笑奈何 提交于 2019-12-23 01:53:23
问题 I am trying to build by source using the static version of the test library. I have both libtest.a and libtest.so available, so I am using the "-static" option. However, It looks like the gcc linker is also trying to search for static version the standard math library. Any idea what option I can use to link the shared versions of the standard libraries? g++ -static main.cpp -o a.out -L. -ltest Error: /usr/bin/ld: cannot find -lm 回答1: If you want to force the linker to use the static version

在Linux Mint下安装Grunt

只愿长相守 提交于 2019-12-22 20:45:48
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> [前言] 前几天重写了一个javascript的ui组件,今天在整合到与原有系统中,并且替换旧版本组件的时候,越来越感觉当前代码的组织,编写,自动化测试以及打包都很有问题。 现在javascript组件是越来越复杂,往往一个项目下来,js模块的数量还是很可观的。项目发布的时候,各种方面因素得考量我们还常常需要合并成一个文件发布。 另外如今有很多新的工具提高我们的开发效率,比如coffeescript,less,在保证第一条的时候我们当然希望以这种高效的方式进行开发。 作为编写过服务端代码的一名coder,我们会用在项目编译的时候同时运行单元测试,或者做持续集成。现在js也有很多单元测试框架,比如Chai,Mocha( 惭愧,俺一个都没有用过... ),要是javascript开发过程中也能自动运行单元测试,实现TDD等开发模式多好。 以上我们完全可以做到,使用Grunt即可。这也是我第一次使用Grunt,首先当然就是要安装Grunt了。 [操作系统] Linux mint 13 [正文] 从 Grunt Getting Started 我们可以了解到,目前Grunt要求您的计算机要安装NodeJS以及npm,其中NodeJS的版本要大于等于0.8.0。 如果您一开始图方便直接使用如下代码安装nodejs

Inheritance of virtual member functions with the same name

我只是一个虾纸丫 提交于 2019-12-22 17:42:47
问题 class A { A() {}; virtual ~A() {}; virtual void Start() {}; virtual void Start(float a) {}; }; class B : public A { }; class C : public A { virtual void Start(float a) {}; } ... B BObj; BObj.Start(); // -> fine, no complain from g++ ... ... C CObj; CObj.Start(); // -> not fine -> error: no matching function for call to ‘C::Start()’ ... I suspect that the problem comes from that both virtual functions have the same name, but different parameter signature. What I would like to know is that this

Inheritance of virtual member functions with the same name

∥☆過路亽.° 提交于 2019-12-22 17:42:18
问题 class A { A() {}; virtual ~A() {}; virtual void Start() {}; virtual void Start(float a) {}; }; class B : public A { }; class C : public A { virtual void Start(float a) {}; } ... B BObj; BObj.Start(); // -> fine, no complain from g++ ... ... C CObj; CObj.Start(); // -> not fine -> error: no matching function for call to ‘C::Start()’ ... I suspect that the problem comes from that both virtual functions have the same name, but different parameter signature. What I would like to know is that this

ISO C++ forbids variable-size array (compilation error)

隐身守侯 提交于 2019-12-22 16:47:22
问题 Normally I always compiled my C code like this: g++ program.c -o program.exe But my college professor requires me to compile using:g++ -o -Wall -Wextra -Werror -pedantic -std=c++0x program.exe program.c (Which is new for me). So ... I run the command and get the following error: eda.c: In function ‘int main()’: eda.c:200: error: ISO C++ forbids variable-size array ‘v’ eda.c:207: error: ISO C++ forbids variable-size array ‘nfloat’ cc1plus: warnings being treated as errors eda.c:215: warning:

g++ static link error against Boost.Log

蹲街弑〆低调 提交于 2019-12-22 11:12:24
问题 I get link errors when statically linking against Boost.Log. The compiler version is g++ 4.8.1. Boost version is 1.55.0. I can do a dynamical link without problems (with a "-DBOOST_LOG_DYN_LINK" in make file) but when I do the static link, I get link errors. This problem won't happen on other boost libraries. I simplified my code to reproduce this issue easily: #include <boost/log/trivial.hpp> int main() { BOOST_LOG_TRIVIAL(trace) << "test trace"; return 0; } The build command that generates

Is it possible to compile C++ code to .exe on a Mac? [closed]

落爺英雄遲暮 提交于 2019-12-22 10:52:53
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I bought a pre-owned Macbook a little while ago and I've been coding inside Sublime Text 2 and compiling in Terminal with g++*. I wrote a stupid text adventure that I'd like to send to a friend and if possible, I