Error compiling Google Protocol Buffer Output (C++) - c++

Update #2: Issue closed, but curious about all the error messages.
I got it to compile after including #define PROTOBUF_USE_DLLS. After the build, the Error List still shows 398 errors and the output window lists a lot of warnings, but it still compiled. Why is that?
I downloaded the Google Protocol Buffer source and was able to compile it without issues on Visual Studio 2015. However, the Google Protocol Buffer compiler generates C++ output that has a lot of compile errors. Is the compiler output below compatible with Visual Studio 2015 (C++14, I think)? Looks like a later standard of C++. If it's not, does anyone familiar with Google Protocol Buffer for C++ know how to make it output VS2015-friendly output? I downloaded from here: https://github.com/protocolbuffers/protobuf/releases
Update: Here's the compiler output:
1> Creating library C:\DEV\Visual Studio 2015\Projects\DEV\VSSolution\x64\Debug\Monitor.lib and object C:\DEV\Visual Studio 2015\Projects\DEV\VSSolution\x64\Debug\Monitor.exp
1>msgcore.pb.obj : error LNK2001: unresolved external symbol "class google::protobuf::internal::ExplicitlyConstructed<class std::basic_string<char,struct std::char_traits,class std::allocator >,8> google::protobuf::internal::fixed_address_empty_string" (?fixed_address_empty_string#internal#protobuf#google##3V?$ExplicitlyConstructed#V?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##$07#123#A)
1>C:\DEV\Visual Studio 2015\Projects\DEV\VSSolution\x64\Debug\Monitor.dll : fatal error LNK1120: 1 unresolved externals
Strange, I see 510 compiler errors under the Error List tab of Visual Studio, but under the compiler output, I only see the one unresolved externals error above. That's a linking error implying that it already compiled? How come I don't see the compiler errors high-lighted in the screenshot below and on the Error List in the Output window?

The errors turned out to be Visual Studio Intellisense errors and not "actual" compile errors. For the one linking error, the issue was resolved by adding #define PROTOBUF_USE_DLLS to the protoc-generated C++ output.

Related

How can I fix "error LNK2019: libifcoremdd.lib(for_main.obj)" in intel visual Fortran

I tried to use a library about date time conversion in this website. However, when compiling it, errors occur:
ERROR 1 error LNK2019: mod_datetime.obj
ERROR 2 error LNK2019: libifcoremdd.lib(for_main.obj)
ERROR 3 fatal error LNK1120: 2 x64\Debug\datetime.exe
There are some similar questions (this or this), but they seems not about this "libifcoremdd.lib" problem. I find libifcoremdd.lib in my computer(C:\Program Files (x86)\Intel\Composer XE 2013 SP1\compiler\lib\ia32 and C:\Program Files (x86)\Intel\Composer XE 2013 SP1\compiler\lib\intel64), why the link process failed?
Expanding on a comment I gave above - the quoted error text omits crucial pieces of information, that being the names of the symbols the linker was unable to find. (LNK2019 is "unresolved reference"). While it's unclear what ERROR 1 is referring to, ERROR 2 is due to your taking the library sources and building them in an executable project type. This causes the linker to look for a symbol _MAIN__ (for 32-bit) that is the Fortran main program. If there is none, then you'll get a LNK2019 error naming for_main.obj in the Intel Fortran run-time library.
The solution is to create a new project in Visual Studio of the "Fortran Static Library" type, so that a main program is not expected.

Compiling error while using CGAL with Boost on Windows with Visual Studio 2017

I'm trying to use CGAL-4.13.1 on my Windows machine with Visual Studio 2017. I followed CGALs instructions for installing on Windows(1), after that I tried some code examples(2). The first and second worked correctly but the third didn't. To be more precise once I had to use
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>.
I got the following error messages:
E0135 "class "boost::mpl::sequence_tag<boost::mpl::list <boost::mpl::na, (followed by 19 times boost::mpl::na,)>>"" has no Member ""type"". cgal_test C:\local\boost_1_70_0\boost\mpl\begin_end.hpp 45
E0135 "namespace "boost::mpl::aux"" has no Member ""list_tag"". cgal_test C:\local\boost_1_70_0\boost\mpl\list\aux_\item.hpp 48
E0070 an incomplete type is not allowed. cgal_test C:\local\boost_1_70_0\boost\mpl\sequence_tag.hpp 111
and many LNK2019: unresolved external symbol errors
I suspect there's an error with the way I include the boost files. But I cant make much more out of the error messages or what I'm supposed to do.
Can someone help me or know what I should do?

LNK2001 error seen on compiling code in x64 environment. However the code compiles fine in x86 environment

I see below linking error on compiling with x64 environment set.
somefile.def : error LNK2001: unresolved external symbol _somesymbol
somepath\somefile.lib : fatal error LNK1120: 1 unresolved externals
gmake[2]: *** [somepath\somefile.dll] Error 1120
When I checked somefile.def generated in x86, it too had the same above symbol, difference being there it had double underscores ('__somesymbol'). Whats the reason behind this?
The code contains both C & C++ files.
Can anyone help in resolving this issue preferably with elaborate explanation?
Thanks
Identifiers do not get decorated in 64-bit code. Blissfully unnecessary, x64 does not have a boatload of calling conventions. Verify this with the linker's map file, ought to be plain somesymbol without a leading underscore. So you surely need to modify the .def file accordingly, we can't see it from here. Do favor the __declspec(dllexport) attribute.
– Hans Passant
I tweaked the make code to generate "somefile.def" with "__somesymbol" instead of "_somesymbol" and could successfully build my x64 bit library and dll files. – Samanyu

How to find syntax errors using Microsoft Visual Studio 2012 in c++?

I have made sure that InteliSense is turned on and that nothing is disabled while I use the IDE. I don't see a way for me to tell where the syntax errors in my code are. When I try to build the project it just gives me that "failed" report and there are no syntax errors being reported in the error box.
http://imageshack.us/f/850/visualt.jpg/
The only errors its giving me are :
Error 2 error LNK1169: one or more multiply defined symbols found C:\Users\Artur\Documents\Visual Studio 2012\Projects\Project2\Debug\Project2.exe 1 1 Project2
Error 1 error LNK2005: _main already defined in Portfolio Program 2.obj C:\Users\Artur\Documents\Visual Studio 2012\Projects\Project2\Project2\Source.obj Project2
These don't seem to make any sense to me.
Visual Studio would normally give you syntax errors if there are any in your C++ code. The error message you're getting suggest that you're linking two modules together that both contain a definition of main(). That won't work as the linker will not be able to determine which of the two main() functions to use as an entry point into the program. So, check your linker and project dependencies.
You have source.cpp in resources. This is wrong.

Unresolved external symbol - IdnToAscii

I tried to build the following sample application available on msdn:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd319089%28v=vs.85%29.aspx
I created a new C++ command line project in Visual Studio 2012 Premium on a windows 7 64bit box, and copied the code of the sample in the main cpp file.
When I try to compile, I get the following error:
Error 1 error LNK2001: unresolved external symbol __imp__IdnToAscii#20
From other posts of people having similar errors, I figure I'm supposed to include some header or lib file. But which one(s)? How do I do that in VS2012/C++ (I'm a complete c++ noob...)
It seems from MSDN, you need to link against Normaliz.dll.
Try adding Normaliz.lib in Linker -> Input -> Additional Dependencies