Share via


Linker Tools Error LNK1276

Error Message

invalid directive 'directive' found; does not start with '/'

When specifying a linker option with the comment pragma, the option must begin with a forward slash.

The following sample generates LNK1276:

// LNK1276.cpp
// LNK1276 expected
#pragma data_seg(".MySeg")
int i = 7;
#pragma comment(linker, "section:.MySeg,E")
// try the following line instead
// #pragma comment(linker, "/section:.MySeg,E")

int main() {
}