I have C++ project in my Visual Studio. Additionally I placed directory with source files in it in order to use them like library in my main project.
Everything works fine while code browsing. I can define includes of library headers and navigate to functions.
I got problem during project build. I got a lot of linking errors which tells that system can't link to functions from library.
Error LNK2019 unresolved external symbol lv_task_create referenced in function monitor_init testLVGL C:\cpp_test\testLVGL\monitor.obj 1
Error LNK2019 unresolved external symbol lv_tick_inc referenced in function "int __cdecl tick_thread(void *)" (?tick_thread##YAHPEAX#Z) testLVGL C:\cpp_test\testLVGL\testLVGL.obj 1
Error LNK2019 unresolved external symbol lv_task_handler referenced in function SDL_main testLVGL C:\cpp_test\testLVGL\testLVGL.obj 1
Looks like Visual C++ is even not trying to build library.
How to tell Visual C++ to include all library files located in subdirectory in order to build and link to project?
Visual Studio does not include all the files in a directory on its own. You need to explicitly include them (you dont have to do this if you add a file within the Solution Explorer or within Visual Studio). Else it wont be listed to the compiler.
To include them, go to the solution explorer and select "Show all files". This will show you all the files in the directory. Then you can see the unlisted files marked with a red icon. Right click it and hit "Include in project" and the red icon will disappear. After this, the file will be listed as one of the project's file.
Related
I'm trying to move a project from LabWindows/CVI 9 to Visual studio, I've been correcting errors by importing cvi libraries, now I've run into this error, but I can't find where the library comes from and it seems to be the last one I'm missing
LNK2019 unresolved external symbol _main referenced in function _WinMain#16 MES_Control_2.0.3.39 cviwmain.lib(extwmain.obj)
in the case of the other libraries it gave the same error but now I can't find extwmain.c or extwmain.lib
Your project already is configured to link cviwmain.lib. The error means it needs a main() function. You probably configured your project as a windows application(not a console application), so just remove that library because you don't need it. See this documentation for detail.
Using Visual Studio Community 2017
I have 4 projects:
Static library project that uses GLFW and couple other libraries
ProjectA which uses that library, compiles fine
ProjectB which also uses that library, compiles fine
ProjectC which I recently created and uses the library, does not compile
ProjectC has the same properties as ProjectB and ProjectA, nothing should be different, right?
But somehow, I get these errors when compiling ProjectC:
glfw3.lib(context.obj) : error LNK2001: unresolved external symbol
__imp___stdio_common_vsscanf
audio.lib(au.obj) : error LNK2001: unresolved external symbol
__imp__stricmp
I tried building GLFW and Audio library from their sources and replaced the project ones with newly built ones, no effect.
Once again, I somehow managed to untick "Inherit from parent or project defaults" checkbox in Additional Include Directories.
Check your checkboxes everybody!
I want to solve the n-queens problem using SCIP (version 3.2.1) in Visual Studio 2010 (version 10.0.40219.1).
Source files can be found here: http://scip.zib.de/download/files/Queens.tgz
I did not write any code myself, but just included queens.hpp, scip_exceptions.hpp, queens.cpp and queens_main.cpp in my VS project.
In the project properties I did the following:
C/C++ -> General -> Additional Include Directories -> C:\scipoptsuite-3.2.1\scip-3.2.1\src\.
When building, I get errors like:
LNK2019: unresolved external symbol SCIPaddCons referenced in function "public: __thiscall cipexamples::QueensSolver::QueensSolver(unsigned int)"
I understand that I will have to link SCIP libraries to my project? But I do not know which ones and where to find them?
You need to compile the SCIP Optimization Suite first to obtain the libscipopt that you need to link to your project. It will contain everything necessary to work with SCIP.
Alternatively, you may also just use the precompiled dlls from the webpage:
http://scip.zib.de/#download
I created a console application project(let's call it ProjectA) in visual studio, and another project which is the googletest project to test the ProjectA. Now I got unresolved external symbol problem when testing functions that have definition in cpp. (If I put everything in .h, there's no problem). How to make the content in the cpp visible to the googletest project? I notice ProjectA only creates a exe but no lib...
Many thanks!
As you have not provided code, I can give high level details.
Try to link your ProjectA to projectB So that when linker try to link it will find the proper definition.
I want my exe to be runnable without depending on any redistributable packages but when I set
"Use of MFC" to "Use MFC in a Static Library" in the Project > Properties menu, I get errors such as this one:
- Error 2 error LNK2019: unresolved external symbol _imp_GetWindowTextW#12 referenced in function _wmain
So basically I get unresolved external symbol for the functions.
Thank you.
In Project->Properties->Linker->Command Line type user32.lib
Under the linker settings for your project, make sure you've included the default libraries under "Additional Dependencies".
This is usually:
kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
Also, make sure have not set "Ignore All Default Libraries".