Why am I warning C4081 about this #pragma?

I have a habit of removing all warnings specified in my code. I just like clean build if possible. I used

#pragma comment(lib,"some.lib");

I get this warning:

warning c4081: expected "new line"; found ';'

I do not know why this will generate a warning. Can I get help removing it?

+3
source share
4 answers

Its a semicolon at the end of the line. It is not needed for #pragma.

edit: the warning says it all: expecting a new line at the end of the pragma, but instead found a comma.

Tested with VS2008

+11
source

, :

#pragma warning(push, 0)        

#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/program_options.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/bind.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/zlib.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/device/back_inserter.hpp>

#pragma warning(pop)

0 - :

#pragma warning( push )
#pragma warning( disable : 4081)
#pragma warning( disable : 4706 )
#pragma warning( disable : 4707 )
// Some code
#pragma warning( pop ) 
+2
#pragma warning(disable: 4081)

. , .

#pragma comment(lib "some.lib") 

4081,

#pragma comment(lib, "some.lib") 

.

?

: , #pragma, ; . .

+1

, , ".lib" (. )

0

Source: https://habr.com/ru/post/1734137/


All Articles