9,774 questions
-5
votes
2
answers
228
views
Splitting C code into separate files without using functions
I want to split blocks of code from the main main.c file into separate files, but I don’t want to use functions because that introduces additional overhead (function call, stack usage, etc.).
I tried ...
4
votes
3
answers
450
views
Why function must be defined with static when compiling
I wanted to see what happens if I include the source file instead of the header file.
main.c
#include <stdio.h>
#include "func.c"
int main(void)
{
printf("%d\n", call());...
0
votes
0
answers
62
views
"Reference to 'Protocol' is ambiguous" when including AppKit.h
When I turn on the Undefined Behavior Sanitizer for my scheme, I get a bunch of "Reference to 'Protocol' is ambiguous" errors in NS*.h headers. I have a .mm file that looks like this:
// ...
6
votes
1
answer
153
views
Is there a way to identify if a GNU AWK script is sourced via `-i` / `@include`?
I am looking for a way to write gawk scripts that can function both as standalone tools and function libraries that can be sourced in other scripts.
The difference is in the BEGIN block that I intend ...
0
votes
0
answers
71
views
Root for relative includes in Qt Creator
I have a C++ project which uses CMake as a build system.
Upstream recently refactored the code, moving most of the project’s own code to a subdirectory. For example, foo/foo_base.hpp is now in subdir/...
1
vote
2
answers
211
views
How to include WebRTC VAD in my C project
I am trying to include WebRTC VAD into my project, specifically I want the feature for distinguishing audio between voiced and unvoiced but having troubles including it. I am using gcc Built by MinGW-...
0
votes
0
answers
79
views
Problem with Additional Header File Directories
I have two VS2022 solutions. In both, I use the identical Directory.Build.props file. However, in one solution, I can add headers in include from these include directories, but in the other, I can't. ...
1
vote
1
answer
189
views
Declareing array that stores a struct, which defined in another file included, gives the error "Incomplete Type "Array[]" is not allowed"
I have defined a struct in another file called file1.h (example) and when I declare an array using that struct in another file called File2.h, i get the error Message:
"Incomplete Type "...
-3
votes
1
answer
145
views
C++ include file with variables in multiple files
i have code:
main.cpp
#include <iostream>
#include "add.h"
#include "var.h"
using namespace std;
int main() {
std::cout << width << height << std::...
2
votes
2
answers
99
views
How can I override a C header residing in the same directory as the source which includes it using only the make call?
The project I am working on is required to incorporate sources from a previous project, however, the configuration of that code differs between the legacy and current project. The legacy source uses a ...
7
votes
1
answer
342
views
R `use(library, function)` a second time
Related to :
Why might one load a library more than once in an R script?
Now, usually, with a complete library import, it is a good idea that a library is not loaded a second time.
However, if my main ...
2
votes
1
answer
151
views
Liquibase templating stored procedure ChangeSets via <include> and <property>
I have N tables for which I need to generate 5 stored procedures each.
All the stored procedures follow the same pattern, except for the table name in the referencing clause.
Would it be possible to ...
1
vote
2
answers
101
views
PHP $_SERVER['DOCUMENT_ROOT'] removed a slash
I read other posts about $_SERVER['DOCUMENT_ROOT'] (like Where to set PHP $_SERVER['DOCUMENT_ROOT'] Trailing Slash?) but what happened to me is that all the pages in my website basically lost the ...
2
votes
1
answer
294
views
Can I get clang-tidy to warn about the use of indirectly-included standard library constructs
Consider the following program:
#include <array>
int main() {
throw std::logic_error("hi");
}
With some C++ compilers (or rather, standard libraries) - this compiles. For example,...
0
votes
1
answer
129
views
clang++ on Mac failing to locate the <iostream> header
I am trying to build a simple C++ program which includes the standard library header <iostream>, on a Mac.
When I compile my program in VS Code, I get the error message:
include errors detected. ...