Skip to content
Advertisement

Tag: g++

why does the local array has extra empty location at the end(c/c++/gcc)?

Check below program, In the above program, even though array size is 10, after the first array there is exactly 6 extra locations reserved in the stack (12bytes), I am wondering why this extra space got reserved? and this extra space size is varying for different size(Its not 12 for size 20). Can anybody explain the concept behind these allocations?

Fast byte copy C++11

I need to convert C# app which uses extensively bytes manipulation. An example: Basically BitConverter and Buffer.BlockCopy called 100s times per sec. There are several classes that inherit from the base class above doing more specific tasks. For example: What approach in C++ should I look into? Answer Best option, in my opinion, is to actually go to C –

Error while linking static library to test script

I’m building a static library for a small project, and when I compile it with ar, it correctly links. When I go to include the relevant header file and link the test script to the archive; I get linker errors; Running ar t libuttu.a returns My test script includes the main header file, uttu.hpp, which itself refers to the np

Segmentation Fault with g++ in Linux Ubuntu, but not with g++/MingW in Windows, when printing a char string in C++ [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 3 years ago. Improve this question

gcc-7: error: unrecognized command line option ‘-m64’

I’m trying to compile C code on a Jetson Nano and I get this error during compiling. I tried removing any occurrence of ‘m -64’ but it seems like its added automatically. This is the cmd where it fails: /usr/bin/gcc-7 -Wall -Wextra -Wconversion -pedantic -Wshadow -m64 -Wfatal-errors -O0 -g -o CMakeFiles/dir/testCCompiler.c.o -c /home/user/dir/CMakeFiles/CMakeTmp/testCCompiler.c gcc-7: error: unrecognized command line option ‘-m64’

Linker can’t find Lua library definition

So, I’m relatively new to C++ and I’ve been trying to run Lua files in my C++ project. To start off things, I ran this simple code: And the terminal command looks like this: Edit: Corrected to this Lua libraries are installed on my system (Linux), but the linker can’t find the definition for luaL_newstate(), despite the fact that I

C – invalid conversion from ‘void*’ to ‘void (*)()’

I am getting the following when I try to compile my program: These are the lines of code that are causing the errors: What am I missing? Answer You have void *function but void* is not a correct type of a function pointer. void (*)() is a type of a function pointer, so probably you should change your function signature:

Advertisement