298 questions
12
votes
1
answer
400
views
Avoiding strcpy overflow destination warning
With a structure such as the following
typedef struct
{
size_t StringLength;
char String[1];
} mySTRING;
and use of this structure along these lines
mySTRING * CreateString(char * Input)
{
...
1
vote
0
answers
226
views
Cargo build using incorrect linker
I'm running into an issue trying to cross compile a simple "hello world".
For my use case, I need to build compile a simple application for both x86_64-apple-darwin and aarch64-apple-darwin ...
1
vote
2
answers
462
views
Where are libc files located [duplicate]
When I write code such as
#include <stdio.h>
int main(int argc, char** argv) {
printf("Hello, world!\n");
return 0;
}
gcc imports stdio.h which in turn requires an associated ...
0
votes
1
answer
2k
views
cargo build error : error: linking with `cc` failed: exit status: 1 on Macbook AIr M2
I am attempting to run and building my rust code, I built the sample rust project using cargo new sampleProject, and then attempted to run it using cargo run and cargo build, both of which are failing,...
0
votes
0
answers
135
views
Are popular c compilers (gcc, clang, etc) not POSIX compliant?
Background
POSIX
The POSIX standard specifies what interface system utilities must have (amongst other things). For example, POSIX says that a conforming system must have a c compiler, and that it ...
0
votes
1
answer
132
views
How can I add a "std=c99" flag to cc when compiling using cargo?
I'm trying to install ripgrep (link to repo) with the pcre2 feature from source.
To do so I run the command cargo build --release --feature 'pcre2' to build the exec.
When doing so, cargo tries to ...
2
votes
1
answer
774
views
Error while loading shared libraries: libpq.so.5
I am trying to write a basic client for Postgres integration in C using libpq, I compiled the libraries following the Client-only installation on this page and so far so good, I compile my program ...
0
votes
0
answers
126
views
Running gtest on AIX
I am trying to run some simple gtest tests on an AIX machine:
#include <gtest/gtest.h>
int add(int a, int b) {
return a + b;
}
// Test case to check addition function
TEST(AdditionTest, ...
1
vote
0
answers
54
views
red hat 9 overlaying of C uninitialized data broken (linker issue) - any solutions other than now using -fcommon?
Since the beginning of time (or at least 1970) unix/linux C has allowed non/un initialized data object to be overlayed in multiple object files even if different sizes. Apparently this is now "...
0
votes
0
answers
110
views
Same versions of Linux, CC, LD have different link order rules
I have a desktop PC and a laptop PC both running identical Linuxes (Ubuntu 22.04.4 LTS) but the desktop has few extra bits and pieces loaded, I would have thought irrelevant, both are running gcc-12 ...
0
votes
1
answer
247
views
How do you get the SBCL foreign function interface example from the SBCL User Manual to work?
I posted the following wanting to experiment with the foriegn functin interface in SBCL. Several good comments came forth. I left out something I didn't understand to be important. My problem working ...
0
votes
1
answer
142
views
cc compiler can't find link library in provided path
I am trying to link against the Tensorflow library. Here is my makefile:
TF_PATH=/home/wade/.local/lib/python3.10/site-packages/tensorflow
CFLAGS=-I$(TF_PATH)/include/ -L$(TF_PATH)/
CC=cc
artifaction ...
2
votes
1
answer
163
views
How does a C compiler parse code like `arr[]`?
It is well known that function declarations like
void foo (int arr[])
and
void foo (int* arr)
are identical since array variables are just pointers to the first element of the array.
My question is ...
3
votes
0
answers
347
views
Linking with 'cc' failed (when trying to compile a simple 'hello_world' for Android terminal)
I'm trying to test what an Android terminal application would be writing the simplest program (hello_world) in Rust. I have downloaded the Android NDK, which I have placed in ~/Android/Sdk/ndk/26.1....
2
votes
2
answers
625
views
How to compile Rust from Linux to macOS?
I have a simple file main.rs, with the print Hello, World from Rust!. Under my system, Linux, everything compiles without any problems, both through rustc and through cargo. But when I want to make a ...
0
votes
1
answer
1k
views
How can I completely remove rust from my computer?
I was trying to build c++ code inside rust, and somehow I made some changes and now I am not even able to do simple cargo build command as it's providing me the following error
error: could not ...
3
votes
0
answers
93
views
Machine-readable metadata autogenerated by Creative Commons (CC) not W3C-compliant
I added a CC license to my website using the Choose a License tool hosted by CC:
<a rel="license" target="_blank" href="http://creativecommons.org/licenses/by/4.0/">...
0
votes
1
answer
3k
views
Golang & CGO – link to a DLL dynamic library
Go language positions itself as a cross-platform language. To me a cross-platform language is that kind of language which is usable on all the supported platforms.
I would like to use its ability to ...
2
votes
1
answer
46
views
Unexpected behaviour in Lex
I have written this code in my bas.l file
digit [0-9]
%%
{digit}{1,5} {printf("Small Number");}
^{digit}+$ {printf("Big Number");}
%%
int main(void){
yylex();
return 0;
}
...
2
votes
1
answer
93
views
Segfault only when using pkg-config --libs for glib.h
I have the following piece of code, compiled with gcc `pkg-config --cflags glib-2.0` test.c -o test the code works, but only when I use gcc `pkg-config --cflags --libs glib-2.0` test.c -o test the ...
2
votes
1
answer
2k
views
How can I know all available cc_toolchains by default, and how to access info of the selected toolchain in bazel?
Bazel seems to be automatically configure the local system and select a cc_toolchain for me. Is there any way I can know of all available toolchain options so that I can choose another one instead of ...
1
vote
0
answers
962
views
Getting "NativeCommandFailed" error when executing program compiled with Mingw64 cc
Executing a Windows executable that was compiled with the cc compiler command (compiler installed with Mingw64 MSYS2 on Windows) results in an unexpected error.
I was compiling a slightly modified ...
3
votes
1
answer
391
views
Beryllium crate does not link with project, linking with cc fails
Allo!
I've been trying to compile an OpenGL example here and so far I've been porting the examples for the newest package versions. After I've finally got the compiler to shut up and compile, it... ...
0
votes
1
answer
309
views
How to make one node communicate with multiple nodes?
I am trying to make my nodes communicate among themselves without changing any data in the message.
Like node one and two echos tictocMsg with themselves node two and three echos the different message ...
4
votes
1
answer
10k
views
Autoconf complains of undefined macro, suggests m4_pattern_allow? what's going on?
I've done a lot of C and some C++ programming, but never used autotools before (I was doing this so long ago, the tools were not yet available to me). Anyway, I'm on Xubuntu 20.04, and I'm following ...
0
votes
3
answers
915
views
Will variable declaration inside infinite loop in c cause stack overflow
This is a simple question, but I would just like to throw this out there and appreciate if anyone could validate if my understanding is correct or provide some more insight. My apologies in advance if ...
0
votes
1
answer
316
views
"TypeError: Error #1010: A term is undefined and has no properties." in Adobe Animate
i am creating a game rn, and i have popup feature on my game,i make 2 popup for my game, but when i aplly the code for the second popup, it doesn't work, can you help me by seeing my code, thank you. ...
0
votes
0
answers
163
views
Stack-Based Overflow Error(strcpy and strncpy)
I have the below code, where the compiler is complaining:
int len = strlen(prgpath);
char* ptr = strrchr(prgpath, '/');
char prgname[64];
memset(prgname, 0, sizeof(prgname));
if (ptr==NULL)
...
7
votes
2
answers
5k
views
How to use less memory when compiling to avoid killing the build?
During using cc linker and cargo, I am repeatedly running into:
= note: collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
My VM has 4 gb of ram allocated ...
0
votes
1
answer
348
views
Does GNU make implicitly compile .c files to .o files?
Noob question. I want to compile bar.c with object file foo.o to an executable bar.
I have this in a Makefile:
bar: foo.o
cc bar.c foo.o -o bar
I run $ make -n and get :
cc -c -o foo.o foo.c
...
0
votes
1
answer
652
views
ld: fatal: file bcPACplacebo.o: wrong ELF class: ELFCLASS32
Below are my environments that I am running my project which has C and CPP codes.
uname -a:
SunOS nzdrb12z 5.11 11.4.40.107.3 sun4v sparc sun4v non-global-zone
cc -V:
cc: Studio 12.6 Sun C 5.15 ...
0
votes
1
answer
802
views
VBA: MailItem.CC Doesn't Seem to be Working
I've got some code designed to automatically send emails with attachments. It's been working 100% fine but I am now required to CC people as well. I thought it should be simple and added the .CC ...
4
votes
1
answer
1k
views
What does gcc -E option stand for?
According to gcc manual, the -E option only preprocesses the .c source file, without running the compiler and just giving an input file (.i). But what does the -E stand for?
-5
votes
1
answer
483
views
unable to compile PuTTY 0.76 on Ubuntu 20.04 [closed]
I'm trying to compile PuTTY 0.76 on Ubuntu 20.04 using the directions from https://7thzero.com/blog/how-to-compile-build-putty-ubuntu-16 and am having some difficulty.
My steps:
wget https://the....
8
votes
3
answers
6k
views
rust diesel linking with `cc` failed
Ok, so kind of getting nowhere here. Before I posted a problem with my Mac M1 having linker issues with Rust Diesel and got nothing. So I spun up an Ec2 instance and tried to run this crate here and ...
4
votes
1
answer
265
views
Anyway to pass string containing compiled code instead of file path to ctypes.CDLL?
Background
I am trying to call C functions inside python and discovered the ctypes library (I'm fairly new to both C and python's ctypes), motive (however stupid) is to make python code's speed on par ...
2
votes
1
answer
2k
views
Should I use gcc or cc when programming in C?
I searched a little bit and one google search was enough to discover the differences between the gcc and cc compilers, but I did not find the advantages in using one or another to compile C programs
...
0
votes
0
answers
136
views
Error When making Shared Object (SO) from C Program Using CC Compiler
I am attempting to compile a simple C program into a .so file using the cc compiler on an AIX system. The program is:
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("...
0
votes
0
answers
76
views
Accessing global variable with this-> pointer in C++? [duplicate]
#include <stdio.h>
void val();
int v=10;
class test{
public:
int v=11;
void val()
{
printv();
}
private:
void printv()
{
int v=12;
printf("V:...
0
votes
1
answer
132
views
How to load combobox value to CC field in Outlook VBA?
I have a userform combobox that allows users to select a project email. I want to be able to select this email, and click on a button in the userform which loads the email into the CC field. I've got ...
2
votes
0
answers
828
views
CC,BCC property not working in outlook email compose option in javascript
In my requirement I need to implement email option. By default I have to open outlook as default composer. I am using below code to open outlook as default
var mailData = 'https://outlook.live.com/...
0
votes
2
answers
1k
views
google-script GmailApp.createDraft {cc:}
I cannot have CC in my reminder email generated from google sheets script.
Here the code:
//seleziono il file
var file_ID = SpreadsheetApp.getActiveSpreadsheet().getId();
var file = DriveApp....
1
vote
1
answer
1k
views
Linking a static library with gcc on Centos7 not working
I have a Java JNI project that uses the following command to build on Mac OS
gcc -g -I/my-project-dir -o libmylibrary.jnilib -lc -shared -I"${JAVA_HOME}"/include -I"${JAVA_HOME}"/...
2
votes
1
answer
371
views
C compiler can't create executables
I'm trying to install the elastic beanstalk cli, like so:
./aws-elastic-beanstalk-cli-setup/scripts/bundled_installer
But I'm getting the following error:
python-build: use openssl from homebrew
...
0
votes
1
answer
3k
views
No such file or directory error when using make
I am still relatively new to Linux, but I have an assignment in my operating systems class that involves several files. My professor gave us his makefile, but it isn't working for me. Make just ...
0
votes
1
answer
707
views
How to kill Linux node processes based on their elapsed time?
I just finished a web scraping app made with puppeteer and node, and at this point in time it is very unstable due to relatively low to none experience with puppeteer (further debugs on it crashing is ...
0
votes
3
answers
132
views
Insert a copy of a row in a table and checking for duplicates
I am looking to copy 4 existing rows in a database and need to change the value of one of the columns in the new rows. I need to do this and also make sure that no duplicates are created. What I have ...
0
votes
3
answers
837
views
Add user input to array of unknown size
I still pretty new to programming and my only prior experience before C was Javascript. I'm doing the CS50 Introduction to Computer Science and in one of the lectures there's an example code that ...
0
votes
0
answers
60
views
using correct -l -L and -I flags with cc still leads to undefined reference [duplicate]
I'm working with a Makefile that issues the following command:
cc -g -O -I/opt/local/include -lsndfile -lm -lpvoc -L/opt/local/lib/ -L/usr/lib/x86_64-linux-gnu/ -c -o fileio.o fileio.c
followed by ...
0
votes
3
answers
632
views
Bit fields portability in a shared library
I have difficulty to understand the portability of bit fields in C. Imagine I have a shared library composed of only two files, libfoobar.h (the public header) and libfoobar.c, with the following ...