Questions tagged [cl]

cl.exe is a tool that controls the Microsoft C and C++ compilers and linker. cl.exe can be run only on operating systems that support Microsoft Visual Studio.

cl.exe is a tool that controls the Microsoft C and C++ compilers and linker. cl.exe can be run only on operating systems that support Microsoft Visual Studio.

301 questions
6
votes
1 answer

How can I run cl using x64?

I had the same problem as here fatal error C1034: windows.h: no include path set I typed vcvars32.bat and that solved my problem but I want to link some 64-bit .lib files and when I do: cl main.cpp xxxlib.lib I get: warning LNK4272: library machine…
sspp
  • 65
  • 1
  • 6
5
votes
1 answer

Why this include order causes link error on unordered_map?

I had a problem with include order that I cannot explain. I will show you a minimal example with four files: // A.h #pragma once #include struct A {}; namespace std { template<> class hash { public: size_t…
Dundo
  • 714
  • 8
  • 12
5
votes
4 answers

Is there a way to add the Developer Powershell for VS 2019 as an integrated terminal in VSCode?

I'm working on a project that requires me to compile C++ code using MSVC, but I am working mostly with VSCode. As such, I was wondering if there is a way for me to add the Developer Powershell as an integrated terminal, so that I can compile without…
Carmo
  • 95
  • 1
  • 6
5
votes
1 answer

Cobra: how to set flags programmatically in tests

I'm using cobra to build a CLI and want to simulate a command being run with different sets of options/flags. I've been trying to figure out how I can use the cobra APIs to set flags within my test but haven't really gotten it yet. I have this: //…
sixty4bit
  • 7,422
  • 7
  • 33
  • 57
5
votes
2 answers

How to turn off exceptions in Microsoft compiler(cl)?

What compiler flags do I use to completely get rid of the exception handling? I don't use them at all but the compiler still generates .pdata and .xdata sections which there for exception handling only.
123qwe
  • 284
  • 4
  • 11
5
votes
0 answers

What is the default structure packing using cl/gcc/clang?

On msdn for cl compiler option /Zp, it is mentioned that "Packs structures on 8-byte boundaries (default)." Does that mean that if there a data type of size > 8 bytes, by default (no compiler option or pragma pack) it would not be naturally aligned…
Abhishek Jain
  • 9,614
  • 5
  • 26
  • 40
4
votes
2 answers

Installed Visual Studio 2022 but 'cl' is not recognized as an internal or external command

None of my terminals on Windows 10 recognize cl 'as an internal or external command'. I have Visual Studio 2022 installed and I've tried it on every terminal, including terminals in the Visual Studio 2022 under the Start menu. I've tried the other…
Ant
  • 933
  • 2
  • 17
  • 33
4
votes
0 answers

How to make long Windows paths work with cl.exe

Refined the causing issue, it seems to be a result of CL.exe not working with long path names. Calling cl.exe directly on a C file in a path with a long folder name results in a "file not found" error Things I have tried: I have turned on long…
Fooble
  • 485
  • 2
  • 14
4
votes
1 answer

C++14 errors in C++17, LNK2019, C1001 altogether

There's a pretty straightforward 3-file source. Compiling with cl.exe. Using /std:c++17 it compiles with c++14 errors (error C3533: a parameter cannot have a type that contains 'auto'). Using /std:c++20 it compiles but gives an LNK2019. When using…
4
votes
1 answer

VC2019 address sanitizer 64 bit link error on windows "unresolved external symbol __asan_shadow_memory_dynamic_address"

The following simple program #include int main(int argc, char **argv) { char* arr=malloc(10); arr[10]='\0'; return 0; } builds fine with VC2019 16.8.2 in 32 bit dynamic linking cl -Zi -fsanitize=address -MD…
Leo
  • 925
  • 10
  • 24
4
votes
0 answers

Building C++ with Cmake using Ninja as generator and cl-clang as compiler

Similar questions have been asked before, but I've run into a problem during linking that I haven't seen addressed so I'm making a new question here. My goal is to compile some C++ code on the command line on Windows using cl-clang as my compiler,…
4
votes
2 answers

Setting up GLEW and GLFW in VS Code with Visual C++

I have a basic Visual C++ environment in Visual Studio Code. I've recently started to read about OpenGL and have been trying to set up GLEW and GLFW in VS Code. Almost all of the tutorials I find fall into one of the 2 categories: GLEW and GLFW…
shamilsdq
  • 126
  • 1
  • 7
4
votes
3 answers

How to configure the VS Code shell like the developer command prompt?

I'm trying to set up a task for compiling my C++ code in Visual Studio Code. I can't get it to work... but the command it spits out works perfectly fine when I just open the Developer Command Prompt and paste it in. I've managed to narrow down this…
gamesaucer
  • 113
  • 1
  • 10
4
votes
2 answers

how to "use unicode character set" in g++?

i'm working on a program in c++ where i'm trying to use the WriteProcessMemory() function in windows. for that i need a function that gets the target process id. i'm able to do that using the following function: #pragma once #include…
jumpindonuts
  • 582
  • 1
  • 6
  • 11
4
votes
0 answers

Microsoft equivalent of ld --relocatable (link into new, relocatable object file)

GNU ld has an option -r / --relocatable to link a number of object files into a new object file. Do the Microsoft tools have a similar feature, either in link, in cl or in some other tool? I do not want to create an archive (because this file will…
user1544337
1
2
3
20 21