I'm compiling a very old codebase under Visual Studio 2017. The code compiles, but the compiler is emitting the following messages, which I don't know how to interpret.
EDIT: Here's the unaltered compiler output
1>------ Build started: Project: Obsidian.DSP.DirectShow, Configuration: Debug x64 ------
1>clock.cpp
1>parsing with MACROS
1>s:\library\obsidian.dsp.directshow\mpeg2demux\mp2demux\clock.cpp(962): warning C4101: 'rtDelta': unreferenced local variable
1>s:\library\obsidian.dsp.directshow\mpeg2demux\mp2demux\clock.cpp(1277): warning C4101: 'rtGetTime': unreferenced local variable
1>s:\library\obsidian.dsp.directshow\mpeg2demux\mp2demux\clock.cpp(286): warning C4101: 'pHead': unreferenced local variable
1>s:\library\obsidian.dsp.directshow\mpeg2demux\mp2demux\clock.cpp(282): note: while compiling class template member function 'void CTClockSubordinate<LONGLONG,LONGLONG>::OnMasterTime(MasterClock)'
1> with
1> [
1> MasterClock=LONGLONG
1> ]
1>s:\library\obsidian.dsp.directshow\mpeg2demux\mp2demux\clock.cpp(1566): note: see reference to function template instantiation 'void CTClockSubordinate<LONGLONG,LONGLONG>::OnMasterTime(MasterClock)' being compiled
1> with
1> [
1> MasterClock=LONGLONG
1> ]
1>s:\library\obsidian.dsp.directshow\mpeg2demux\mp2demux\clock.h(410): note: see reference to class template instantiation 'CTClockSubordinate<LONGLONG,LONGLONG>' being compiled
1>AssemblyInfo.obj : /DEBUG:FASTLINK is not supported when managed code is present; restarting link with /DEBUG:FULL
1>AssemblyInfo.obj : MSIL module encountered; incremental linking is disabled for MSIL; performing full link
1>Obsidian.DSP.DirectShow.vcxproj -> S:\Obsidian.Topaz\x64\Debug\Obsidian.DSP.DirectShow.dll
1>ALINK : warning AL1073: Referenced assembly 'mscorlib.dll' targets a different processor
1>Done building project "Obsidian.DSP.DirectShow.vcxproj".
========== Build: 1 succeeded, 0 failed, 16 up-to-date, 0 skipped ==========
That's it, no more information. Is it some kind of warning? Should I modify the code?
Here's an example of how one of these templates are defined (under a .cpp file)
template <class HostClock,class MasterClock>
void
CTClockSubordinate <HostClock, MasterClock>::OnMasterTime (
IN MasterClock MasterTime
)
{
...
}
Related
I'm trying to embed Google Test in my project. I am using:
Project Type: Visual Studio 16 2019
Toolset: Intel C++ Compiler 19.0
Architecture: 64 bits
CMake version: 3.16.1
I am following the instructions of Google Test readme
I am using the master branch (version 1.10) of Gtest repository.
Cmake runs ok, and Visual Studio solution is generated. But when building it, cmock and gtest projects fail to build with the following errors:
1>gtest-all.cc
1>Error #2586: \'operator=\' : decorated name length exceeded, name was truncated
1>gmock-all.cc
1>C:\Users\saa4\Downloads\googletest-master\googlemock\include\gmock/gmock-actions.h(816): message #411: class template "testing::internal::InvokeMethodAction<Class, MethodPtr>" defines no constructor to initialize the following:
1> const member "testing::internal::InvokeMethodAction<Class, MethodPtr>::obj_ptr"
1> const member "testing::internal::InvokeMethodAction<Class, MethodPtr>::method_ptr"
1> struct InvokeMethodAction {
1> ^
1>
1>C:\Users\saa4\Downloads\googletest-master\googlemock\include\gmock/gmock-actions.h(845): message #411: class template "testing::internal::InvokeMethodWithoutArgsAction<Class, MethodPtr>" defines no constructor to initialize the following:
1> const member "testing::internal::InvokeMethodWithoutArgsAction<Class, MethodPtr>::obj_ptr"
1> const member "testing::internal::InvokeMethodWithoutArgsAction<Class, MethodPtr>::method_ptr"
1> struct InvokeMethodWithoutArgsAction {
1> ^
When setting the compiler to Visual C++ it builds normally. Do I need te set any extra configuration parameter for Intel?
I need help with creating a dynamic library for linux using Visual Studio Linux Development Extension. I have never developed for linux but I did my research and I'm stuck. I can't figure out what is wrong.
I'm using this extension. https://blogs.msdn.microsoft.com/vcblog/2016/03/30/visual-c-for-linux-development/
So here is what I did. first I created an empty linux project in visual studio called foo. I added a class called foo.h and foo.cpp.
foo.h
#ifndef foo_h__
#define foo_h__
extern void foo(void);
#endif
foo.cpp
#include <stdio.h>
void foo(void)
{
puts("Hello, I'm a shared library");
}
in the Configuration Properties I changed the Configuration type from Application(.out) to Dynamic Library(.so)
in C/C++ -> Command Line -> I added "-fpic".
I saved and I built the project.
This is my output
1>------ Rebuild All started: Project: foo, Configuration: Debug x64 ------
1> Cleaning remote project directory
1> Validating architecture
1> Validating sources
1> Copying sources remotely
1> Starting remote build
1> Compiling sources:
1> foo.cpp
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(1190,5): warning MSB8012: TargetExt(.so.1.0) does not match the Linker's OutputFile property value (.0). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(1191,5): warning MSB8012: TargetName(libfoo) does not match the Linker's OutputFile property value (libfoo.so.1). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1> Linking objects
1> foo.vcxproj -> C:\Users\Fantasy-Desk\Desktop\test\foo\foo\bin\x64\Debug\libfoo.so.1.0
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
After that I created a Linux Console Application which has a main.cpp file.
#include <stdio.h>
#include "../foo/foo.h"
int main(void)
{
puts("This is a shared library test...");
foo();
return 0;
}
In the Configuration Properties -> Linker -> Input -> Library Dependencies I add "foo" and in Additional Dependencies I add my "libfoo.so.1.0" directory in my linux machine which is "projects/foo/bin/x64/Debug"
When I build the project it fails and I get this output
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug x64 ------
1> Validating architecture
1> Validating sources
1> Copying sources remotely
1> Starting remote build
1> Compiling sources:
1> main.cpp
1> Linking objects
1>/usr/bin/ld : error : File format not recognized
1>collect2 : error : ld returned 1 exit status
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
I can't figure this out and google is no help. Can someone please tell me what is wrong and why can't I compile and link and run my application?
Thanks
In "Additional Dependencies", you need to specify actual library filenames, not directories.
I had installed armadillo library on window visual studio 2013. When i attempted to build the solution. The following build error occurred. Any help will be appreciated.
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug x64 ------
1> Source.cpp
1>c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(787): error C4146: unary minus operator applied to unsigned type, result still unsigned
1> c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(1626) : see reference to function template instantiation 'bool arma::diskio::convert_naninf<eT>(eT &,const std::string &)' being compiled
1> with
1> [
1> eT=arma::u32
1> ]
1> c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(1652) : see reference to function template instantiation 'bool arma::diskio::load_arma_ascii<arma::u32>(arma::Mat<arma::u32> &,std::istream &,std::string &)' being compiled
1> c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(1571) : see reference to function template instantiation 'bool arma::diskio::load_arma_ascii<double>(arma::Mat<double> &,std::istream &,std::string &)' being compiled
1> c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/Mat_meat.hpp(6553) : see reference to function template instantiation 'bool arma::diskio::load_arma_ascii<double>(arma::Mat<double> &,const std::string &,std::string &)' being compiled
1> c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/Mat_meat.hpp(6536) : while compiling class template member function 'bool arma::Mat<double>::load(const std::string,const arma::file_type,const bool)'
1> Source.cpp(50) : see reference to function template instantiation 'bool arma::Mat<double>::load(const std::string,const arma::file_type,const bool)' being compiled
1> c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/typedef_mat_fixed.hpp(41) : see reference to class template instantiation 'arma::Mat<double>' being compiled
1>c:\users\haixun\desktop\test_programs\testingapplication\armadillo-5.100.2\include\armadillo_bits/diskio_meat.hpp(794): error C4146: unary minus operator applied to unsigned type, result still unsigned
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Sorry that someone downvoted your question; it seems reasonable to me.
These are warnings, which in this particular case are harmless. You must have the option turned on to treat warnings as errors. Your options seem to be:
Turn off the option to treat warnings as errors.
Turn off that particular warning (project wide).
Turn off that particular warning whenever you #include <armadillo>.
Option 3 is probably best, especially if the warnings as errors option is company policy. Make sure to push and pop the warning options; see this MSDN page on warning pragmas. You could put the whole lot (pragmas and include) into a little header file, which is probably a good idea anyway since Visual Studio won't autocomplete #include <armadillo> (since it doesn't have a file extension).
In Visual Studio Express 2010, I can usually only build a program once and then to make any changes I have to paste my code into a new project. It will say that the build was successful, but then I try to run it and get an error message saying,
"This project is out of date-- would you like to build it?"
and I click yes and I get another error message saying that there were build errors and I have to continue from the last successful build. Sometimes instead of running the last successful build I get an error message saying,
"Unable to open [directory to program]. The system cannot find the
file specified."
I usually use Visual Express 2012 for this reason but even then it happens every now and then, seemingly at random. Once the issue begins there is no apparent way to fix it (rebuilding and restarting Visual Studio both have the same result). In Visual Studio Pro 2012 this also seems to happen.
EDIT: This is in the output box of the one in front of me (2010 edition)
1>------ Build started: Project: Lab01, Configuration: Debug Win32 ------
1> Lab01.cpp
1>c:\program files (x86)\reference assemblies\microsoft\framework\.netframework\v4.0\system.core.dll : warning C4945: 'ExtensionAttribute' : cannot import symbol from 'c:\program files (x86)\reference assemblies\microsoft\framework\.netframework\v4.0\system.core.dll': as 'System::Runtime::CompilerServices::ExtensionAttribute' has already been imported from another assembly 'mscorlib'
1> c:\windows\microsoft.net\framework\v4.0.30319\mscorlib.dll : see declaration of 'System::Runtime::CompilerServices::ExtensionAttribute'
1> first seen type is used; re-order imported assemblies to use the current type
1> This diagnostic occurred while importing type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
1>Lab01.cpp(28): error C2664: 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::get(_Elem &)' : cannot convert parameter 1 from 'char [101]' to 'char &'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I guess it says the error in there but it tells me "build succeeded" for some reason...
Here's how to find and analyze errors reported by Visual Studio:
continue from the last successful build - Click NO (almost always). Errors should show up in the View->Error List. When confused, always check View->Output window after a build, it's a lot of the same info but more detailed.
rebuilding ... same result - A full rebuild should give some other error than project is out of date.
Lab01.cpp(28): error C2664: - Line 28 and 3 lines up and down of Lab01.cpp would be helpful.
Looks like you're doing something with std:: streams that isn't correct, but I don't know what without seeing the code. This should be in the Error List
warning C4945: - This occurs because you're using a mix of .net 4.0 and 4.5 and (possibly) a mix of clr and non-clr code within a single project. Recreating from a new CLR project which has chosen the correct .Net library version everywhere may remove this warning. (ExtensionAttribute got moved during the 4.0 to 4.5 upgrade)
This is just a warning, so shouldn't matter.
Here's a snippet from my build output in Visual Studio 2010:
1>------ Build started: Project: Engine, Configuration: Release_PG
Win32 ------ 1>icl : warning #10187: PGOPTI instrumentation disables
multifile optimizations 1>icl : warning #10188: PGOPTI instrumentation
disables IP optimizations
1> !BasketNovel.cpp 1> Compiling
precompiled.h - this should happen just once per project. 1> 1>
Compiling BasketNovel.h. 1>
1> Camera.cpp 1> Compiling
precompiled.h - this should happen just once per project. 1> 1>
Compiling BasketNovel.h. 1>
1> Console.cpp 1> Compiling
precompiled.h - this should happen just once per project. 1> 1>
Compiling BasketNovel.h. 1>
1> Entity.cpp 1> Compiling
precompiled.h - this should happen just once per project. 1> 1>
Compiling BasketNovel.h. 1>
1> Font.cpp
From what I see, the compiler's building my .cpp files in alphabetical order. I'm not really familiar with build concepts. Is this a normal behaviour?
Note: I am using the Intel C++ compiler.
The order of compilation is not really important. The important step that builds your end-product (executable, library, etc) is the linking step, where the pieces from the compilation step will be linked together.