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
- gcc static library compilation
- Different behavior of async with Visual Studio 2013(Windows8.1) and GCC 4.9(Ubuntu14.10)
- How to add directories to Cygwin gcc default search path
- Usage of #ifndef directive
- Failure to link a program with gcc -static
- Text as parameter in inline assembly (ARM)?
- Alternatives for strrspn and strfind functions(libgen functions in Solaris) in AIX?
- Incorrect format specifier with gcc compiler
- Why should I use a closing bracket in this?
- How can I compile *without* various instruction sets enabled?
- Automatically wrap C/C++ function at compile-time with annotation
- gcc compiled library: can successfully link with, how come it's "undefined symbol" when run the program?
- compiling caffe on Yosemite
- error - /usr/bin/ld: cannot find -lavutil in ubuntu 15.04
- Compatibility of libstdc++.so libgcc_s.so when upgrading GCC 4.1 to GCC 4.8.2
Related Questions in LINKER-ERRORS
- Can't build ios app with 64bit Support
- Mach-o Linker Error
- opencv 3.0.0 linker error when instantiating Mat object
- Linker cannot find existing Static Library File
- SFML and VS2013 - WinMain/main linker error
- Connecting C++ and Postgresql
- VS2013 Unresolved External with constructor and destructor
- Error: ld returned 1 exit status June 2015
- GHC undefined reference to Paths in dependency
- CUDA __device__ Unresolved extern function
- Xtensa --- dangerous relocation: windowed long call crosses 1GB boundary
- Static Initialization order fiasco: how can we ensure that library X would get linked only once Protobuf is done?
- xCode ld library not found in release mode and duplicate symbols in debug mode
- link.exe returns error LNK1181: cannot open input file 'C:\Program.obj'
- Train net using caffe DLL in C++
Related Questions in EXTERN
- Advantages of using extern after the declaration of fucntion pointer in the same header file
- Passing a struct to a template with extern const. What is the extern for?
- Declaration and definition in C programming with extern
- SDL with C++ calling Fortran: Scope and Initializer error
- Share typedef struct array used in file among other files
- Debugging a project that uses C++ and C# projects in Visual Studio
- Extern variable seems to have two addresses?
- Some mystic with 'extern' pointer to struct in C
- clang : error : undefined reference to
- Is that possible to define mongo::DBClientReplicaSet as a global variable in a class?
- How to declare and call a function with unknown arguments?
- Placement of extern variable
- extern declaration, T* v/s T[]
- Initializing/Preparing class objects in separate files before main()
- Square brackets after float4 vector type
Related Questions in GCC-WARNING
- Getting a “format not a string literal and no format arguments” warning while using GTK+2
- MinGW 5.1.0 no longer seems to suppress warnings
- Parameter of returned generic lambda allegedly shadows parameter of free function
- the issue convert buffer to hex string in c
- Printf of long double, unknown conversion type character L
- Ignoring note: offset of packed bit-field without using "-Wno-packed-bitfield-compat"
- code generating wreorder warning
- g++ alternative to Java's @SuppressWarnings annotation
- GCC issues warning of incompatible pointer type
- Resolving a warning in macro
- Options for suppressing "comparison is always false due to limited range of data type" warning
- Why no warning when uint32 casts to uint8 with gcc C
- Are curly braces really required around initialization?
- Temporarily disable warnings on specific versions of GCC
- invalid conversion gcc -fpermissive
Related Questions in LINKER-FLAGS
- Setting LD_LIBRARY_PATH from inside R
- Performance loss with gcc linker optimization flag -flto
- Other Linker Flags missing in Xcode Build Settings
- Missing link flags for targets when using set_target_properties and LINK_FLAGS
- Linker failed in D compiler (dmd)
- SEGGER Embedded Studio .a file linkage questions
- Xcode 6 static library project
- Duplicate symbols between Facebook SDK and AWS v2
- _cvLoadImage undefined symbols linking issue
- Why few of my symbols don't appear in my .so file?
- CGO compilation error: invalid flag in go:cgo_ldflag: -Wl,--enable-stdcall-fixup
- Difference between add_compile_options and add_link_options also flags each option supports
- How to add linker option to CMake bootstrap?
- ld Mac OS 10.13.6 : unknown option: -EL
- What do link editor (LD) params mean?
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 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: