Troubleshooting
This page lists common vix.app problems and how to fix them.
Use it when vix build or vix run does not behave as expected.
Project not detected
You may see an error like:
Unable to determine the project directory.or:
Missing CMakeLists.txt or vix.app.This means Vix could not find a project root.
A vix.app project must have this structure:
myapp/
vix.app
src/
main.cppRun the command from the project root:
cd myapp
vix buildOr pass the project directory explicitly:
vix build --dir ./myappCMakeLists.txt is used instead of vix.app
Vix resolves projects in this order:
1. CMakeLists.txt
2. vix.appIf both files exist:
myapp/
CMakeLists.txt
vix.appVix uses:
CMakeLists.txtTo use vix.app, rename or remove the CMake file:
mv CMakeLists.txt CMakeLists.txt.bakThen run:
vix buildMissing name
A vix.app file must define a target name.
Incorrect:
type = executable
standard = c++20
sources = [
src/main.cpp,
]Correct:
name = hello
type = executable
standard = c++20
sources = [
src/main.cpp,
]The name field is used as the default build target and executable name.
Invalid name
Target names should be simple.
Recommended:
name = helloname = my_appname = my-appAvoid spaces or special characters:
name = "my app"If the name is invalid, use only:
letters
numbers
_
-Example:
name = my_appMissing sources
A vix.app target needs source files.
Incorrect:
name = hello
type = executable
standard = c++20Correct:
name = hello
type = executable
standard = c++20
sources = [
src/main.cpp,
]Source file not found
You may see:
vix.app source file not found: src/main.cppThis means the file listed in sources does not exist.
Check your project layout:
hello/
vix.app
src/
main.cppCorrect manifest:
sources = [
src/main.cpp,
]Paths are relative to the directory containing vix.app.
Wrong relative path
If vix.app is in the project root:
myapp/
vix.app
src/
main.cppCorrect:
sources = [
src/main.cpp,
]Incorrect:
sources = [
myapp/src/main.cpp,
]because vix.app is already inside myapp/.
Wrong path inside tests
If vix.app is inside tests/:
mathlib/
src/
add.cpp
tests/
vix.app
test_add.cppCorrect:
sources = [
test_add.cpp,
../src/add.cpp,
]Incorrect:
sources = [
tests/test_add.cpp,
src/add.cpp,
]Paths are relative to tests/.
Invalid target type
Supported target types are:
type = executabletype = statictype = static-librarytype = sharedtype = shared-librarytype = libraryIncorrect:
type = exeCorrect:
type = executableInvalid C++ standard
Supported values include:
standard = c++17standard = c++20standard = c++23Incorrect:
standard = cpp20Correct:
standard = c++20Malformed array
Arrays can be inline:
sources = [src/main.cpp, src/app.cpp]or multi-line:
sources = [
src/main.cpp,
src/app.cpp,
]Incorrect:
sources = [
src/main.cpp,
src/app.cpp,The closing ] is missing.
Correct:
sources = [
src/main.cpp,
src/app.cpp,
]Unknown field
If you use a field that vix.app does not support, Vix may report an unknown field error.
Incorrect:
target = helloCorrect:
name = helloSupported fields:
name
type
standard
sources
include_dirs
defines
links
compile_options
link_options
compile_features
packages
resources
output_dirHeader not found
You may see a compiler error like:
fatal error: myapp/app.hpp: No such file or directoryCheck your layout:
myapp/
include/
myapp/
app.hpp
src/
main.cppIf your code has:
#include <myapp/app.hpp>then your manifest needs:
include_dirs = [
include,
]Header files listed as sources
Usually, headers do not need to be listed in sources.
Avoid this:
sources = [
src/main.cpp,
include/myapp/app.hpp,
]Prefer this:
sources = [
src/main.cpp,
]
include_dirs = [
include,
]Duplicate main function
You may see a linker error about multiple definitions of main.
This often happens in tests.
Incorrect test manifest:
sources = [
test_app.cpp,
../src/main.cpp,
../src/app.cpp,
]If both test_app.cpp and main.cpp define main(), the linker fails.
Correct:
sources = [
test_app.cpp,
../src/app.cpp,
]Keep main.cpp thin and test the application logic from other source files.
Undefined reference to main
You may see:
undefined reference to mainThis usually means you declared an executable target without a main() function.
Incorrect:
name = mathlib
type = executable
sources = [
src/add.cpp,
]Correct for a library:
name = mathlib
type = static
sources = [
src/add.cpp,
]Correct for an app:
name = hello
type = executable
sources = [
src/main.cpp,
]and src/main.cpp should contain:
int main()
{
return 0;
}Package not found
You may see:
Could not find a package configuration file provided by "fmt"Example manifest:
packages = [
fmt:REQUIRED,
]
links = [
fmt::fmt,
]This means CMake could not find the package.
Possible fixes:
- install the package
- set CMAKE_PREFIX_PATH
- check the package name
- use CMakeLists.txt for custom dependency setupExample with CMAKE_PREFIX_PATH:
vix build -- -DCMAKE_PREFIX_PATH=/path/to/fmtPackage found but target not linked
packages only calls find_package(...).
You still need to link the imported target:
packages = [fmt:REQUIRED]
links = [fmt::fmt]Incorrect:
packages = [
fmt:REQUIRED,
]Correct:
packages = [
fmt:REQUIRED,
]
links = [
fmt::fmt,
]Imported target not found
You may see an error like:
Target "myapp" links to:
fmt::fmt
but the target was not found.Common causes:
- the package was not found
- the target name is wrong
- the package does not export that imported target
- links contains a target that does not existCheck the package documentation.
For example, fmt commonly uses:
links = [
fmt::fmt,
]Boost components commonly use:
links = [
Boost::system,
Boost::filesystem,
]Boost package syntax error
If a package has components, quote the value.
Correct:
packages = [
"Boost:COMPONENTS=system,filesystem:REQUIRED",
]Incorrect:
packages = [
Boost:COMPONENTS=system,filesystem:REQUIRED,
]The comma can be interpreted as an array separator if the value is not quoted.
Linker flag in compile_options
Do not put linker options under compile_options.
Incorrect:
compile_options = [
"-Wl,--as-needed",
]Correct:
link_options = [
"-Wl,--as-needed",
]Use:
compile_optionsfor compiler flags.
Use:
link_optionsfor linker flags.
Compiler flag not supported
Some flags work only with specific compilers.
Example:
compile_options = [
-Wall,
-Wextra,
]These are common with GCC and Clang, but not always valid for MSVC.
If portability matters, keep compiler-specific flags minimal.
Resource not copied
Check that the resource path exists.
Project:
myapp/
assets/
logo.pngCorrect:
resources = [
assets,
]Incorrect:
resources = [
asset,
]Resource paths are relative to the directory containing vix.app.
Resource copied but app cannot find it
Resources are copied next to the built target.
If you use:
output_dir = bincheck:
build-ninja/bin/not:
build-ninja/Also remember that relative file access in C++ depends on the process working directory.
If your program does:
std::ifstream file("config/app.json");make sure the process is running from the expected directory, or resolve paths relative to the executable.
Executable not found after build
vix run tries to find the built executable using the target name.
Check your manifest:
name = myapp
type = executableThen check common output locations:
build-ninja/myapp
build-ninja/bin/myapp
build-release/bin/myappIf your project is a library:
type = staticthen there may be no executable to run.
Use:
vix buildor create a test executable under:
tests/vix.appvix run on a library
vix run is mainly for executable targets.
For a library:
name = mathlib
type = staticuse:
vix buildTo run tests:
cd tests
vix runwhere tests/vix.app builds an executable test target.
output_dir confusion
If you set:
output_dir = binthe output is placed under the build directory:
build-ninja/bin/not under:
project/bin/output_dir is relative to the CMake build directory.
Generated CMake file is missing
For vix.app projects, Vix generates:
.vix/generated/app/CMakeLists.txtIf it is missing, run:
vix buildIf generation fails, check the manifest errors first.
Do not edit generated CMake
Do not edit:
.vix/generated/app/CMakeLists.txtEdit:
vix.appThe generated file can be overwritten by Vix.
Need raw CMake output
Use:
vix build --cmake-verboseThis shows more CMake configure output.
You can also use:
vix build -vfor a more detailed Vix build summary.
Need to pass CMake variables
Pass extra CMake arguments after --.
Example:
vix build -- -DCMAKE_PREFIX_PATH=/path/to/prefixAnother example:
vix build -- -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined"For complex CMake variables, consider using a normal CMakeLists.txt.
Build directory is stale
If the build behaves strangely, remove the build directory.
rm -rf build-ninja build-dev build-releaseThen rebuild:
vix buildOr use:
vix build --clean.vix/generated is stale
If the generated CMake project looks stale, remove it:
rm -rf .vix/generated/appThen rebuild:
vix buildUsing vix.app with complex CMake logic
vix.app is not meant to express every CMake feature.
Use CMakeLists.txt for:
- custom commands
- generated sources
- install rules
- CTest
- FetchContent
- CPM.cmake
- custom toolchains
- many targets in one project
- package export files
- advanced platform-specific logicDebug checklist
When a vix.app project fails, check this list:
1. Am I in the directory containing vix.app?
2. Does CMakeLists.txt exist? If yes, Vix uses it first.
3. Is name defined?
4. Is sources defined?
5. Do all source files exist?
6. Are include_dirs correct?
7. Is type correct?
8. Is standard written as c++17, c++20, or c++23?
9. Are packages and links both present when using imported targets?
10. Are resource paths correct?
11. Am I checking the right build directory?Minimal known-good vix.app
Use this to verify that vix.app works:
name = hello
type = executable
standard = c++20
sources = [
src/main.cpp,
]With:
hello/
vix.app
src/
main.cppsrc/main.cpp:
#include <vix.hpp>
int main()
{
vix::print("hello");
return 0;
}Run:
vix build
vix runSummary
Most vix.app issues come from:
- wrong relative paths
- missing sources
- missing include_dirs
- CMakeLists.txt taking priority
- packages not linked through links
- trying to use vix.app for complex CMake workflowsKeep the manifest simple and explicit.
When the project becomes complex, use CMakeLists.txt.
Next steps
Continue with: