gcc4.4

Why do I get a multiple definition error while linking?

不打扰是莪最后的温柔 提交于 2020-01-01 10:51:54
问题 I use these two files here and here. I created a class in two separate files: modul1.h #ifndef MODUL1_H #define MODUL1_H #include <iostream> #include <fstream> #include "easylogger.h" class Modul1 { public: Modul1(std::string name); protected: private: easylogger::Logger *log; }; #endif // MODUL1_H and modul1.cpp #include "modul1.h" Modul1::Modul1(std::string name):log(new easylogger::Logger(name)) { //ctor //std::ofstream *f = new std::ofstream(name.c_str(), std::ios_base::app); //log-

mac OSX Unknown pseudo-op: .type

空扰寡人 提交于 2019-12-25 01:53:43
问题 I have to write some assembler code. Therefore I installed gcc4.4 (per homebrew) and called gcc-4.4 -c asma.s , but it does not work as expected: asma.s:3:Unknown pseudo-op: .type asma.s:3:Rest of line ignored. 1st junk character valued 97 (a). The first lines consist only of standard pseudo-ops! .text .globl asma .type asma, @function asma: Do I have to install an alternative assembler? 回答1: .type is an ELF / COFF directive, while OSX uses Mach-O format. In most cases you can safely remove

can I use auto with g++ 4.4?

▼魔方 西西 提交于 2019-12-11 02:15:13
问题 I can specify -std=c++0x for compilation with my g++ 4.4, and initializer lists are correct, I may use them (in c++98 I can't) but still get errors when try use auto keyword: std::list< std::vector<int> > li2; li2.push_back({1, 2, 3}); //push_back vector li2.push_back({4, 2, 6}); //again, vector implicitly for (auto& vv : li2) { for (auto &i : v) printf("element: %d\n", 8); } so I assume I can't use C++11 functionallities with g++4.4. I have 4.4 because of compatibility with CUDA. 回答1: This

Random integers with g++ 4.4.5

 ̄綄美尐妖づ 提交于 2019-12-10 21:17:28
问题 I'd like to generate random integers in some interval. I don't want to use the basic implementation of srand with time(NULL) as the seed since I have read that it is not the most "random" way of doing this. I have seen lots of posts describing how to use std::uniform_int_distribution in C++11, but unfortunately, I work on a computing cluster that is still stuck with g++ 4.4.5, which doesn't have this capability. Is there anything similar available for this compiler? 回答1: I assume you need

Why do I get a multiple definition error while linking?

半腔热情 提交于 2019-12-04 07:49:35
I use these two files here and here . I created a class in two separate files: modul1.h #ifndef MODUL1_H #define MODUL1_H #include <iostream> #include <fstream> #include "easylogger.h" class Modul1 { public: Modul1(std::string name); protected: private: easylogger::Logger *log; }; #endif // MODUL1_H and modul1.cpp #include "modul1.h" Modul1::Modul1(std::string name):log(new easylogger::Logger(name)) { //ctor //std::ofstream *f = new std::ofstream(name.c_str(), std::ios_base::app); //log->Stream(*f); //log->Level(easylogger::LEVEL_DEBUG); //LOG_DEBUG(*log, "ctor ende!"); } Now I want to use

GCC 4.4: Avoid range check on switch/case statement in gcc?

南楼画角 提交于 2019-12-03 12:27:51
问题 This is only an issue on GCC versions prior to 4.4, this was fixed in GCC 4.5. Is it possible to tell the compiler the variable used in a switch fits within the provided case statements? In particular if it's a small range and there's a jump table generated. extern int a; main() { switch (a & 0x7) { // 0x7 == 111 values are 0-7 case 0: f0(); break; case 1: f1(); break; case 2: f2(); break; case 3: f3(); break; case 4: f4(); break; case 5: f5(); break; case 6: f6(); break; case 7: f7(); break;

GCC 4.4: Avoid range check on switch/case statement in gcc?

眉间皱痕 提交于 2019-12-03 01:59:47
This is only an issue on GCC versions prior to 4.4, this was fixed in GCC 4.5. Is it possible to tell the compiler the variable used in a switch fits within the provided case statements? In particular if it's a small range and there's a jump table generated. extern int a; main() { switch (a & 0x7) { // 0x7 == 111 values are 0-7 case 0: f0(); break; case 1: f1(); break; case 2: f2(); break; case 3: f3(); break; case 4: f4(); break; case 5: f5(); break; case 6: f6(); break; case 7: f7(); break; } } I tried xor'ing to low bits (as the example), using enums, using gcc_unreachable() to no avail.

Expressions \"j = ++(i | i); and j = ++(i & i); should be a lvalue error?

筅森魡賤 提交于 2019-11-27 12:18:05
I was expecting that in my following code: #include<stdio.h> int main(){ int i = 10; int j = 10; j = ++(i | i); printf("%d %d\n", j, i); j = ++(i & i); printf("%d %d\n", j, i); return 1; } expressions j = ++(i | i); and j = ++(i & i); will produce lvalue errors as below: x.c: In function ‘main’: x.c:6: error: lvalue required as increment operand x.c:9: error: lvalue required as increment operand But I surprised that above code compiled successfully, as below: ~$ gcc x.c -Wall ~$ ./a.out 11 11 12 12 Check the above code working correctly. While other operators produce error (as I understand).

Expressions "j = ++(i | i); and j = ++(i & i); should be a lvalue error?

落花浮王杯 提交于 2019-11-26 18:11:49
问题 I was expecting that in my following code: #include<stdio.h> int main(){ int i = 10; int j = 10; j = ++(i | i); printf("%d %d\n", j, i); j = ++(i & i); printf("%d %d\n", j, i); return 1; } expressions j = ++(i | i); and j = ++(i & i); will produce lvalue errors as below: x.c: In function ‘main’: x.c:6: error: lvalue required as increment operand x.c:9: error: lvalue required as increment operand But I surprised that above code compiled successfully, as below: ~$ gcc x.c -Wall ~$ ./a.out 11 11