Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to link project after Enable Profiling (VS2019 community) #82

Open
DiscipleOfEris opened this issue Jan 18, 2023 · 2 comments
Open

Comments

@DiscipleOfEris
Copy link

This is very similar to the (closed) issue #31, but for Visual Studio 2019 community edition. It's for a large x64 project.

I have installed the micro-profiler extension. However, when I Enable Profiling (with the checkmark now visible) and recompile, the linker fails. I get one warning and three errors (two of which are repeated multiple times).

Warning	LNK4044	unrecognized option '/micro-profiler_x64.lib'; ignored
Error	LNK2001	unresolved external symbol _penter
Error	LNK2001	unresolved external symbol _pexit
Error	LNK1120	2 unresolved externals

The LNK4044 warning and LNK1120 error each happen once. The two LNK2001 errors comprise the remaining 520 errors (for each .obj file the linker tries to resolve), for a total of 1 warning and 521 errors.

It seems to me that $(MICROPROFILERDIR)/micro-profiler_$(PlatformName).lib in the Project Properties > Linker > Input > Additional Dependencies setting is being resolved as /micro-profiler_x64.lib, rather than pointing to an actual directory. My initial guess is that this is where the problem lies.

image

For information completeness, the /GH /Gh flags were automatically added by the Enable Profiling button as well.

image

The project is able to compile fine when I uncheck the Enable Profiling option.

@tyoma
Copy link
Owner

tyoma commented Jan 19, 2023

@DiscipleOfEris did VS restart help you? Unfortunately, my fix with simple termination of the spawn MSBuild.exe doesn't help - the environment variables are not getting set for the restarted MSBuild instances. The only safe solution (as of now) is to restart VisualStudio - then the MICROPROFILERDIR variable gets set and the new instance of VisualStudio will build fine.

@DiscipleOfEris
Copy link
Author

@tyoma I did restart VS to no avail, but an additional restart of my computer seemed to to the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants