---
title: Missing module version (ModuleVersionMissing)
framework: swift-compiler
role: article
role_heading: Article
path: swift-compiler/documentation/diagnostics/module-version-missing
---

# Missing module version (ModuleVersionMissing)

Warnings that indicate the compiler cannot resolve an #if canImport(<ModuleName>, _version: <version>) directive because the module found was not built with a -user-module-version flag.

## Overview

Overview Developers may conditionalize which code is active in a source file based on the module version number of an imported dependency module, like this: import Dependency

#if canImport(Dependency, _version: 1.2) // Use declarations introduced in version 1.2 of Dependency #else // ... #endif A dependency’s module version must be established by passing the -user-module-version flag when compiling the sources of the dependency the module. If no -user-module-version flag was specified when the dependency module was built, then the compiler will warn that it cannot resolve the #if canImport directive: warning: cannot find user version number for module 'Dependency'; version number ignored [#ModuleVersionMissing] If this diagnostic is emitted, then the #if canImport directive implicitly evaluates true.

## See Also

- [@dynamicCallable implementation requirements (DynamicCallable)](swift-compiler/documentation/diagnostics/dynamic-callable-requirements.md)
- [Add @preconcurrency import (AddPreconcurrencyImport)](swift-compiler/documentation/diagnostics/add-preconcurrency-import.md)
- [Always enabled availability domains (AlwaysAvailableDomain)](swift-compiler/documentation/diagnostics/always-available-domain.md)
- [Argument matching for trailing closures (TrailingClosureMatching)](swift-compiler/documentation/diagnostics/trailing-closure-matching.md)
- [Calling a mutating async actor-isolated method (ActorIsolatedMutatingAsync)](swift-compiler/documentation/diagnostics/actor-isolated-mutating-async.md)
- [Calling an actor-isolated method from a synchronous nonisolated context (ActorIsolatedCall)](swift-compiler/documentation/diagnostics/actor-isolated-call.md)
- [Captures in a `@Sendable` closure (SendableClosureCaptures)](swift-compiler/documentation/diagnostics/sendable-closure-captures.md)
- [Compilation caching (CompilationCaching)](swift-compiler/documentation/diagnostics/compilation-caching.md)
- [Conforming to `StringInterpolationProtocol` (StringInterpolationConformance)](swift-compiler/documentation/diagnostics/string-interpolation-conformance.md)
- [Conversion from `@isolated(any)` function type to synchronous function type (ConversionFromIsolatedAnyToSynchronous)](swift-compiler/documentation/diagnostics/conversion-from-isolated-any-to-synchronous.md)
- [Cross-isolation data race (RegionIsolationCrossIsolationDataRace)](swift-compiler/documentation/diagnostics/region-isolation-cross-isolation-data-race.md)
- [Deprecated declaration warnings (DeprecatedDeclaration)](swift-compiler/documentation/diagnostics/deprecated-declaration.md)
- [Deprecated implementation-only imports (ImplementationOnlyDeprecated)](swift-compiler/documentation/diagnostics/implementation-only-deprecated.md)
- [Dynamic exclusivity (DynamicExclusivity)](swift-compiler/documentation/diagnostics/dynamic-exclusivity.md)
- [Embedded Swift language restrictions (EmbeddedRestrictions)](swift-compiler/documentation/diagnostics/embedded-restrictions.md)
