I am compiling my .so library code and came across a weird problem. In one the the header file i have decleared a variable extern that is included in other .c file and not defined any where. Code compiles fine and while runtime it gives error. Why no error or warning at compile time ? I am using gcc 9.
extern variable not define but no error from compiler
534 Views Asked by Sanjeev At
1
There are 1 best solutions below
Related Questions in GCC
- File refuses to compile std::erase() even if using -std=g++23
- the difference between two style of inline ASM
- Why veneer code generated by gcc for cortex-m0 seems 8-byte aligned?
- How to compile the Linux kernel with -O0 for more detailed debug?
- GMP Windows installation "configure: error: could not find a working compiler"
- Unable to run get .exe file from assembly NASM
- Problem with compiling c++ project that is running python code using Python.h -> undefined reference
- How to use a newer linker and glibc in a Kotlin/Native project?
- "Config.guess failed to determine the host type" when trying build binutils-2.7 with Cygwin
- Trying to compile GCC returns a bunch of errors
- Compiling with gcc fno-common option causes performance degradation
- On cygwin I get errors containing -lintl and -liconv when running gcc
- Constant function pointer optimization
- How to obtain mingw-w64 version 9.3.0 or older for MSYS2?
- How to fix this error in terminal while writing hello world code in VS Code on C?
Related Questions in LINKER-ERRORS
- link.exe unresolved external symbol _mainCRTStartup
- Linking errors with includes in C++ nested modules
- Dev c++ [Linker error] undefined reference to `__chkstk_ms'
- Undefined symbols for arm64 when building with `swift build`
- How can I remove a lib file from "Commandline" in VS2017?
- Troubles with linking Rust lib when compiling as shared lib for Android using NDK
- undefined reference to `__mingw_vsscanf' while trying to link GLFW statically on VScode
- C program using a wrapper libtorch c++ library not linking
- Linker issues while cross compiling for ARM(arm6ec) platform
- Why is the function version tag consistently "Base" in HDF5 library?
- LNK2019 link against D3DCompiler problem?
- Is it allowed in iOS - Swift Dynamic Framework - Contains Multiple Static Library
- Linker command failed with exit code 1 (use -v to see invocation). I'm only studying and don't know what to do
- How can I properly link Boost when compiling with Emscripten?
- What could cause linking errors with global variables in header and cpp file?
Related Questions in EXTERN
- char array vs. char pointer in C
- Undefined reference variable using extern keyword
- warning: no previous extern declaration for non-static variable 'c' [-Wmissing-variable-declarations]
- Declaring extern structures in header file in C
- How to use a WinAPI struct in UASM without writing it and its members
- How to define size of class array parameter in source file?
- Using pragma in .c and .h file
- What exactly is static variable behaviour in multiple linkeage of a library that contains it in C++?
- identical variables declared 'extern' in multiple translation units can be unique entities?
- extern const declaration as pointer causes hard fault in C?
- How to declare some extern variables in a namespace in a header file
- the extern keyword in c language
- C extern keyword correct use
- Error "multiple definition of ... first defined here"
- How to return structs, Result, Option from Rust in WASM?
Related Questions in GCC-WARNING
- GCC: trying to use -Werror or -pedantic using pragmas
- Neither -Wunused-result, nor --warn-unused-result generates warnings about unused results
- GCC Format attribute not working on function pointer with "using" alias
- Compiler prints HelloWorld whereas Chat GPT says it should only print Hello
- what to do if this error "storage size of `temp_q_trig1' isn't known" occurs in ST programming
- How to resolve C printf %b format warnings
- gcc12 warning use-after-free with shared_ptr of type array
- Is g++ -Wdangling-reference warning justified in this case?
- GCC warns about assigning an initializer list into a vector
- Incompatible pointer type assignment for double pointer to constant double pointer
- GCC warning: how to ignore -Wswitch-default on enum
- can't run simple code in C language in visual studio code
- GCC 5 or newer version
- GCC warning for unintended pointer arithmetic on string literals
- Getting incompatible pointer type warning because the return of the function is not void* but a struct pointer
Related Questions in LINKER-FLAGS
- Windows CMD shows from a custom package even with -H windowsgui flag
- Why is it okay to create this shared lib without -l flags for dependencies?
- How should I conditionally set -isystem and -L flags in CMake?
- CGO compilation error: invalid flag in go:cgo_ldflag: -Wl,--enable-stdcall-fixup
- Why few of my symbols don't appear in my .so file?
- MSVC linker Export of characters from an executable file without a .exp file
- How do you add paths to libraries for cmake when using the ninja generator and the LLVM compilers?
- Invalid property <visibility>, unknown feature 'visibility' in boost build/b2/bjam
- The difference between GCC `-symbolic` and LD `-Bsymbolic` options
- How do I properly link the Google Protocol Buffers library with my application at compilation?
- Pybind11 build with poetry
- Compiler flags for C++ using OpenGL, GLUT, GLEW
- Linker complains about -fPIE yet unable to fix
- How to force a static library at a specific memory address
- Extract compiler and linker flags from Bazel
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Use
-Wl,--no-undefinedand specify the libraries where your functions come from on the command line. For example, if libraryxuses functions defined in libraryy: