You are here:

C++/reading reference table


How are you? I have a program that needs to read in a reference table during runtime. The program would refer to this table from time to time. The table is basically two 1-dimensional arrays of doubles. Currently I do it by referring to a function which is nothing more than the statements for arrays:

void readRef()
array1[0]=2.45; array2[0]=5.17;
array1[1]=3.78; array2[1]=3.12;
array1[1700]=4.67; array2[1700]=0.12;

I do this because I don't know how to make a text file part of the compiled application (static). Anyway, my method should work, but I run into weird problems. For example it compiles on 32 Debian to give a 1 MB executable which runs fine. When I compile the same program on 64 bit Scientific Linux (RedHat) it takes a long time to compile and the executable is 70 MB and it won't run (I get a weird message that an X-something is not found). I'm using Qt. I'm pretty sure that my functions that contain all the array definitions cause this. Do you know what is happening? I'm very thankful for any ideas.


Well, one reason I could suggest is perhaps your environments are incompatible! while one  assumes the integer size or pointer size to be 32bit, the other doesn't. Your Debian might be relying on undefined behaviour. There could be other reasons. My advise: Try to read up some blogs about this. This is mainly a research you should find out. sometimes, your programming environment(in this case Debian) have assumed that  pointers can be stored in 32 bit structures but  tends not to work when  the same programme now runs on RedHat which might be 64 bit.


All Answers

Answers by Expert:

Ask Experts




I can confidently answer any question both basic and advanced in C++. Areas like templates, algorithms, Gui and design patterns are of interest to me. i will not answer questions about web programming.


I have a 3- year- work experience in software Engineering.

I am a bachelor of Engineering graduate

©2017 All rights reserved.