Visual Studio error: /W needs an argument - c++

I get the title's error (said to be in file "cl" line 1) but I got no idea of the meaning...
I imported the projet via the .pro file (I need to use visual studio and Qt, because I'm using CONDITION_VARIABLE and Qt only allows his own QWaitCondition. and using QWaitCondition is not an option for me).

The option /W is used to select a warning level for the compiler. But you also have to specify which level you want.

Related

/Zc:threadSafeInit flag in VS 2015

VS 2015 has a new flag /Zc:threadSafeInit that directs the compiler to generate code to make function local statics thread safe. However, I am unable to get this directive to take effect in my IDE. If I set it as Additional Options in the compiler command line property sheet, I get the following warning during build:
1>cl : Command line warning D9025: overriding '/Zc:threadSafeInit' with '/Zc:threadSafeInit-'
I don't see any instance of the latter anywhere in my project property sheets or .vcxproj files.
Anybody can guess what is going on here? Is there a possibility /Zc:threadSafeInit is conflicting with some other compiler option?

What's the cause of a D8049 error in visual studio?

I'm creating a project with openframeworks (the full source is here: https://github.com/morphogencc/ofxAsio/tree/master/example-udpreceiver), and the empty project seems to compile fine.
I added the ASIO library, and a few header classes, and now the project seems to be give me the following error:
1>------ Build started: Project: example-udpreceiver, Configuration: Debug x64 ------
1> main.cpp
1>cl : Command line error D8049: cannot execute 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\c1xx.dll': command line is too long to fit in debug record
1>cl : Command line error D8040: error creating or communicating with child process
I couldn't find any examples of error D8049 on stackoverflow or even on Microsoft's pages, and google turned up painfully few results. The only remotely useful one was this github issue:
https://github.com/deplinenoise/tundra/issues/270
But I'm still not sure what's causing the problem. Is anyone familiar with this error, and can recommend a method for troubleshooting what's causing it?
thanks in advance!
For me, working with UE4, this was an intermittent error.
I added "bLegacyPublicIncludePaths = false;" to the innermost block of project.Build.cs and recompiled without errors.
Then I removed that line and compiled again w/o errors.
The error message suggested adding "DefaultBuildSettings = BuildSettingsVersion.V2;" to project.Target.cs which worked.
This is a bit of a weird sounding error, as it is from essentially internally generated data. However, you do have control over that. Taking the error message at face value, you probably have many/lots of defined symbols passed in on the command line (or the the ones you do have have lengthy definitions), or you may have some lengthy file paths.
If you look under the project properties, one of the selections under the C++ section is "Command Line", which will show you exactly what gets passed to the compiler. When you view that you can see where you have many or lengthy parameters, and then make changes to shorten them.
Too many defines? Put them in a header (possibly stdafx.h) and include them that way.
Long file paths? Shorten the paths, put the files somewhere else, or set up file system aliases to your real directories that use shorter paths.

How do you run cl.exe from cmd using the same settings as in MSVS?

I have a c++ project in MSVS 2010 Express. I have been planning to write several unit tests to validate this project. Right now they go along the following lines:
#include "header.h" //Header is the header for the source I want to test
void testSomeFunction()
{
//Call function (from external src, prototype in header.h)
//Save output to file
}
int main()
{
testSomeFunction();
return 0;
}
I am creating these source files outside my project because I want to be able to run each of them as individual executable, but I am having trouble getting the Microsoft linker to link them.
This is my problem so far (CMD output):
cl ut_Converter.cpp Converter.obj
ut_Converter.cpp
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xlocale(323) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:ut_Converter.exe
ut_Converter.obj
Converter.obj
Converter.obj : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in ut_Converter.obj
Converter.obj : fatal error LNK1313: pure module detected; cannot link with ijw/native modules
I never really use Microsoft products, I'm familiar with using the GNU tools GCC and make but I have to use the Microsoft tools for this and I have no idea how they work.
Maybe I'm going about building these tests the stupid way but it's the best way I can think of right now.
This is what I want to do:
Compile the source files in my project into object files
Compile my test files into object files
Link the test object file with the appropriate project object files to produce the test executable
How do I go about doing that? (I'm guessing there are some settings I need to set to make everything compatible but I have no idea what they are or how I would go about setting them)
Extra: I know it mentions the debug level but I'd be willing to bet that there will be other incompatible settings. Is there a way to find out what the settings are in the program so I can pass them to cl.exe when I run it?
Edit: When I say command prompt I do mean the one that comes with Visual Studio with all the environment variables setup.
Have you tried going to Programs / Microsoft Visual ... / ... Tools / ... Command Prompt, and running from that dos console window which has the environment variables setup?

How to fix "no member named 'somefunction' in the global namespace"

Environment: Windows 7, Visual Studio 2012, Pepper_34
We have an application that requires parallel processing. We used to use TBB for that. Now porting to PNaCl, we wanted to use this opportunity to switch to using a thread pool built around std::thread in C++11.
Before making the switch, the application (not using TBB) builds for PNaCl without errors.
We know that we will need C++11 for the new thread pool so I enabled C++11 with the command line -std=c++11.
Now I get several errors similar to:
T:\nacl_sdk\pepper_34\toolchain\win_pnacl\usr\include\c++\v1\cstdio(138,9): error : no member named 'snprintf' in the global namespace
So I'm surely missing a compile flag, a command line argument, a pathname or something because this error is generated from compiling cstdio.
Same kind of error when compiling
T:\nacl_sdk\pepper_34\toolchain\win_pnacl\usr\include\c++\v1\__locale and
T:\nacl_sdk\pepper_34\toolchain\win_pnacl\usr\include\c++\v1\locale
Are those pathnames correct?
So my question is what am I missing here to get rid of those errors?

Visual Studio 2010 external tool args empty

Trying to use arguments for external tools within the custom build option in VS2010 but they seem to be empty, specifically:
c:\oracle\ora10g1\bin\proc $(ProjDir)\$(ItemFilename).pc
Fails with:
PCC-F-02101, Unable to open input file: ".pc"
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 1.
Yet file exists and hardcoded reference compiles.
Try enclosing the macros in double-quotes...
c:\oracle\ora10g1\bin\proc "$(ProjDir)\$(ItemFilename).pc"
I suspect your problem is the embeded spaces in the final path.
OK - I figured it out - there is a "macro" button in the dialog for specifying the custom build arguments - it has the correct definitions.
here's what works:
c:\oracle\ora10g1\bin\proc $(ProjectDir)%(Filename)%(Extension)
I believe that the doco that referenced "Arguments for External Tools" is either incorrect or they don't consider args used within the custom build dialog to be feeding an external tool.