I have this code written in "Visual studio community edition" in main.cpp and built a release version called Test.exe
#include <iostream>
int main()
{
int i = 0;
i++;
std::string s;
std::cout << "Hello World" << i << std::endl;
std::cout << "Hello World1" << std::endl;
std::cin >> s;
std::cout << s << std::endl;
}
When I load it up in Ghidra the 0x140001290
but when load same binary in x64dbg I see the address 0x00007FF777311290
see picture
here are the threads (just incase)
Update: Added file that show link to main.cpp:
Question: How come these addresses are diffrent in Ghidra compare to x64dbg?
Because of ASLR, program will be loaded into randomized base address.
Here are some tips to overcome the problem that x64dbg and Ghidra showing different address:
/DYNAMICBASE:NO
linker option to disable ASLRIMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE
(0x40) attribute from OptionalHdr.DllCharacteristics
(PE Bear showing OptionalHdr.DllCharacteristics having IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE attribute)