Skip to content

Issues with appending file while recursive walk #219

@AlexandrPutenikhin

Description

@AlexandrPutenikhin

Hello,

I am writing a build script for my game engine. The script is split in 2 stages:

  1. Compilation
  2. Linking

The compilation stage is fine, but the linking has errors. It runs:

[INFO] CMD: cc -Wall -Wextra -o ../bin/gnost 'cc -Wall -Wextra -o ../bin/gnost ''
/usr/bin/ld: невозможно найти ��.G^: Нет такого файла или каталога
collect2: error: ld returned 1 exit status

But it should run:

[INFO] CMD: cc -Wall -Wextra -o ../bin/gnost ../obj/main.o

Here's the code:

#define OBJ_DIR "../obj"
#define BIN_DIR "../bin"
bool link_files(Nob_Walk_Entry entry) {
  if (entry.type == FILE_REGULAR) {
    Cmd* linkCmd = (Cmd*) entry.data;
    nob_cmd_append(linkCmd, entry.path);
  }
  return true;
}
Cmd cmd = {0};
nob_cmd_append(&cmd, "cc", "-Wall", "-Wextra", "-o", BIN_DIR"/gnost");
if (!nob_walk_dir(OBJ_DIR, link_files, .data = &cmd)) return 1;
if (!cmd_run(&cmd)) return 1;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions