g++

VS Code - Cygwin as Integrated Terminal

血红的双手。 提交于 2019-12-31 08:46:28
问题 I would like to use Cygwin as the integrated terminal on Visual Studio Code on my Windows laptop (as this would give me use of the Linux terminal commands git and G++, etc.) but when I set the value for "terminal.integrated.shell.windows": to the address of the Cygwin application ( .exe ) then it opens a new Cygwin terminal rather than remaining in VS Code. So my question is: can I use Cygwin integrated into the VS Code terminal and use that to use commands on it ( mkdir , rm , etc.) but also

After Segfault: Is there a way, to check if pointer is still valid?

拜拜、爱过 提交于 2019-12-31 07:05:08
问题 I plan to create a logging/tracing mechanism, which writes the address ( const char* ) of string literals to a ring-buffer. These strings are in the read-only data-segment and are created by the preprocessor with __function__ or __file__ . The Question : Is it possible, to analyze this ring-buffer content after a Segfault, if all pointers are valid? With "valid" I mean that they point to a mapped memory area and dereferencing won't cause a segmentation fault. I'm working with Linux 2.6.3x and

Compling C++ code using command line

大城市里の小女人 提交于 2019-12-31 06:07:52
问题 A am using below command to compile my c++ code and which is using OpenCV libraries and my command is just like opencv main.cpp -o binary_name where opencv is an alias command like alias opencv="g++ `pkg-config --cflags opencv` `pkg-config --libs opencv`" but if I forget the "-o binary_name" the command delete my source file. Why this happening....? What modification should I made on the above alias command to compile my source file like opencv main.cpp binary_name Thanks in advance.......

How does g++ not report error with the given code?

余生颓废 提交于 2019-12-31 03:04:41
问题 This is a continuation of my answer to why is elapsedtime giving me an output of 1? I was able to successfully compile and build the following program using g++ 4.7.3. #include <iostream> using namespace std; int elapsedtime(int time1, int time2) { return (time2-time1); } int main() { int time1; int time2; cin >> time1 >> time2; cout << "Your elapsed time is " << elapsedtime <<endl; } The intent of the last line in main is: cout << "Your elapsed time is " << elapsedtime(time1, time2) <<endl;

Having trouble compiling in VS Code terminal, which is Windows Powershell

拈花ヽ惹草 提交于 2019-12-31 01:52:07
问题 When I right click Run code, and have run in terminal on in my user settings I get these errors. At line:1 char:63 + ... "c:\Users\Josh\Documents\Programming\Learning to Program\" && g++ Exe ... + ~~ The token '&&' is not a valid statement separator in this version. At line:1 char:99 + ... \Learning to Program\" && g++ Exercise36.cpp -o Exercise36 && "c:\Use ... + ~~ The token '&&' is not a valid statement separator in this version. At line:1 char:102 + ... ercise36 && "c:\Users\Josh

Linux cross-compiler for Cygwin — not able to find the Linux Cygwin compiler tool chain online

爷,独闯天下 提交于 2019-12-30 18:25:09
问题 I have installed Cygwin and followed the necessary steps to install the right packages to allow for Linux cross-compilation on Windows. More info on procedure here Compiling Linux binaries (x86/x86-64) under Windows However, I am not able to obtain the actual Linux compiler tools from the source above, or anywhere online (after hours of searching). The download to the Linux cross-compiler for Cygwin points to Metamod-P, I wonder what Metamod-P is. How or where can I get the required Linux

What's a “recursive_init_error” exception?

好久不见. 提交于 2019-12-30 17:43:47
问题 I decided to do a test with computed gotos and local statics void g() { std::cout << "init "; } void f() { int z = 0; y: z++; static int x = (g(), z == 1 ? ({ goto *&&y; 0; }) : 0); } int main() { f(); std::cout << "!"; f(); } I wanted to see whether the output would be "init init !". But to my surprise I didn't get that output, but instead GCC handled it gracefully, outputting at runtime: init terminated by recursive_init_error: exception What's that exception? Is it a Standard exception? C+

Suppress candidates suggested by GCC

末鹿安然 提交于 2019-12-30 09:40:12
问题 I'm using gcc 4.7.2. My code is rather heavy on template and boost usage. When I compile and I've defined or used something ambiguous, I often get error messages that suggest two dozen candidates, usually defined in their separate "in file included from [some deep path]:", with corresponding error messages per candidate on why that particular candidate fails. Especially using boost and templates, even a single error like this becomes completely unintelligible. My question: Is there an option

Trouble linking against LLVM with project including Flex and Bison

主宰稳场 提交于 2019-12-30 09:39:07
问题 I've been working through a tutorial on writing compilers with Flex, Bison, and LLVM (http://gnuu.org/2009/09/18/writing-your-own-toy-compiler/), and attempting to compile the final binary fails with many of the following "undefined reference" errors: g++ -o parser `llvm-config --libs core jit native --cxxflags --ldflags` *.cpp /tmp/ccl0CSyi.o: In function `NBinaryOperator::codeGen(CodeGenContext&)': codegen.cpp:(.text+0x2ce): undefined reference to `llvm::BinaryOperator::Create(llvm:

Is an xvalue's lifetime extended when it is bound to a const lvalue reference?

旧时模样 提交于 2019-12-30 08:25:10
问题 If I write the following code: #include <iostream> using namespace std; int main() { cout << &(int &&)123 << endl; return 0; } Then g++ complains: foo.cc: In function ‘int main()’: foo.cc:7:20: error: taking address of xvalue (rvalue reference) Ok, thanks to What are rvalues, lvalues, xvalues, glvalues, and prvalues? I get that an xvalue means that it's about to "expire", which makes sense. But now if I do this: #include <iostream> using namespace std; int main() { const int &x = (int &&)123;