EIPStackGroup / EIPStackGroup/OpENer
[Windows] Link error LNK2019 due to case mismatch in function name getMicroSeconds / GetMicroSeconds
- Dominant language
- C
- Stars
- 857
- Forks
- 314
- Avg merge
- 18d 2h
- Merged PRs (30d)
- 1
Description
**Description**
When building OpENer 2.3.0 on Windows using Visual Studio (or CMake with NMake), the linker fails with an unresolved external symbol `getMicroSeconds`. The cause is a case mismatch between the function declaration/definition and its usage in `networkhandler.c`.
**Environment**
- OS: Windows 10/11
- Compiler: Visual Studio 2022 / 2026 (MSVC)
- CMake version: 3.31+
- OpENer version: 2.3.0 (or current master)
**Steps to Reproduce**
1. Clone the OpENer repository.
2. Create a build directory, e.g., `bin/win32`.
3. Run CMake configuration:
`cmake -G "Visual Studio 17 2022" -A Win32 ..\..\source`
(or use `-G "NMake Makefiles"` if preferred)
4. Build the project (either open the generated `.sln` in Visual Studio or run `nmake` / `cmake --build .`).
5. Observe linker error.
**Error Log**
```
WIN32PLATFORM.lib(networkhandler.obj) : error LNK2019: unresolved external symbol getMicroSeconds referenced in function GetMilliSeconds
D:\...\Release\OpENer.exe : fatal error LNK1120: 1 unresolved externals
```
**Root Cause**
In `source/src/ports/WIN32/networkhandler.c`, the function `GetMicroSeconds` is defined, but inside `GetMilliSeconds` it is called as `getMicroSeconds` (lowercase 'g'). Since C/C++ is case‑sensitive, the linker cannot find the lowercase version.
**Snippet from `networkhandler.c`**
```c
MicroSeconds GetMicroSeconds() {
// implementation using QueryPerformanceCounter...
}
MilliSeconds GetMilliSeconds(void) {
return (MilliSeconds) (getMicroSeconds() / 1000ULL); // <-- lowercase call
}
```
**Proposed Fix**
Change the call in `GetMilliSeconds` to use the correct uppercase name:
```c
MilliSeconds GetMilliSeconds(void) {
return (MilliSeconds) (GetMicroSeconds() / 1000ULL);
}
```
After this change, the project compiles successfully.
**Additional Context**
This issue occurs only on Windows because the `networkhandler.c` file is platform‑specific. The POSIX implementation does not have this problem.
**Suggested Improvement**
To avoid similar issues, consider enforcing a consistent naming convention across all platform ports, or add a declaration for the lowercase version if it is intentionally different.
---
Feel free to adjust any details (like the exact Visual Studio version or paths) before posting. Thank you for contributing to OpENer!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.