C\C++ Project Compile and Link Issue Fix

1 Windows Platform Issue Fix

1.1 Error LNK1112 module machine type ‘x64’ conflicts with target machine type ‘x86’

Severity Code Description Project File Line Suppression State
Error LNK1112 module machine type ‘x64’ conflicts with target machine type ‘x86’ libcef_dll_wrapper E:\git-code\cef_binary_79.1.35+gfebbb4a+chromium-79.0.3945.130_windows64\build\libcef_dll_wrapper\x64\Debug\shutdown_checker.obj 1
How to Fix:
1.Linker->Commandline->/machine:X64(32)
2.Configuration->Preprocessor->Preprocessor Definitions->WIN32改爲_WIN64
3.Check your dependent lib and dll, If they all compile in x64.

1.2 inconsistent dll linkage

If you have a Dll or Lib project, you have a Interface like this, you will got this error. You just need Add the ROUND_BUFFER_EXPORTS export macro in project “Preprocessor Definition” to fix this error.

#ifndef __ROUND_BUFFER_H__
#define __ROUND_BUFFER_H__

#ifdef __cplusplus
extern "C" {
#endif

#ifdef _WIN32
#ifdef ROUND_BUFFER_EXPORTS
#define ROUND_BUFFER_API __declspec(dllexport)
#else
#define ROUND_BUFFER_API __declspec(dllimport)
#endif
#else
#define ROUND_BUFFER_API
#endif

#ifdef _WIN64
	typedef unsigned long long ulonglong;
#else 
	typedef unsigned long ulonglong;
#endif
	ROUND_BUFFER_API void buffer_reset();
    ...............................
#ifdef __cplusplus
}
#endif
#endif // __ROUND_BUFFER_H__

1.3 LNK1000 Internal error during IMAGE::BuildImage

  1. Configuration->Target Extension to your supposed extension if you was changed the extension.
  2. Configuration ->Whole Program Optimization -> No Common Language Runtime Support.
  3. Configuration ->General ->Enabled Increment Link ->No(/INCREMENTAL:NO)
    The above operation is I have done to fix the error. but I thought those operation was not the root cause…

1.4 The build tools for v142 (Platform Toolset = ‘v142’) cannot be found.

1.Click the project Open the Property=>General=>Platform Toolset=>Change to the toolset you have installed=>rebuild it.
2.Update your VS IDE installed the toolset the target project needed.

1.5 How to Open Windows Coredump

Save below code to your local machine, then rename the local to **.reg. If you wan to open this function just double click this reg file.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\]
"DumpFolder"=hex(2):44,00,3a,00,5c,00,43,00,72,00,61,00,73,00,68,00,44,00,75,\
  00,6d,00,70,00,73,00,00,00
"DumpCount"=dword:0000000a
"DumpType"=dword:00000002

1.6 Error LNK2019 unresolved external symbol _Sleep referenced in function _thread_work_func

2 Linux Platform Issue Fix

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章