[vtkusers] error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

John Drescher drescherjm at gmail.com
Mon May 6 07:49:39 EDT 2013


> AFAIK, you should compile the sources first in order to get them used/installed elsewhere. That is, the instructions there say that you should directly build the INSTALL project, which I have not used myself.
>
> But AFAIK, the INSTALL project just copies the headers and compiled libraries to a given location when you do not want to have access to the source files from that other location. And in order to produce the libraries (whether they are linked as static (*.lib in Windows) or dynamic (*.dll in Windows), you should first build all core projects.
>
> Now, may be if VTK sees that the sources are not compiled when you compile INSTALL, it compiles them first. I am not sure about this.
>
> There are a couple of linker issues outlined on that page as well. Check that you actually have the necessary libraries built and that the test or example you are trying to run knows where they lie.
>
> VTK's CMakeLists should do that for you if you are running its built-in examples.
>
> You may also check some compatibility issues between the VTK version you are using and your compiler.
>

The INSTALL target will compile everything and install it in a system
location if you have the user right to do so. However using that will
lock you into using whatever configuration that you built the INSTALL
target of VTK. So if you built vtk in Release mode you can only build
your application in Release mode.. The reason for this is Microsoft's
Debug CRT is incompatible with the release CRT. You can avoid some of
the incompatibility by not using vtk shared libraries. Also the final
part of this old tutorial about setting Additional Include Directories
and libraries I would not recommend unless the user has a lot of
experience with these and understands how to track down missing
symbols. Its far easier to let CMake handle this for you even on the
windows platform with Visual Studio (which is what I have done for 5+
years at work).

John



More information about the vtkusers mailing list