所以我有这个程序在我的家用机器上编译很好,但是一旦我在大学服务器上编译它就会打破......:/这对我的屁股来说是一个巨大的痛苦.我不知道可能导致错误的位置或原因.我首先从大学的valgrind报告开始.
==13527== Memcheck, a memory error detector
==13527== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==13527== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==13527== Command: ./main stock.dat coins.dat
==13527==
==13527== Invalid write of size 8
==13527== at 0x402762: load_data (in /RMIThome/shr/5/s3234575/Assignments2/main)
==13527== by 0x4028BE: main (in /RMIThome/shr/5/s3234575/Assignments2/main)
==13527== Address 0x6172676f72502074 is not stack'd, malloc'd or (recently) free'd
==13527==
==13527==
==13527== Process terminating with default action of signal 11 (SIGSEGV)
==13527== General Protection Fault …Run Code Online (Sandbox Code Playgroud)