I have two relatively simple problems to solve. I'm using Visual C++ as my compiler. I have my code written and it runs fine when I build, compile, and debug it. However, when I set the configuration manager to release, I receive errors that say the source file is not linked to the appropriate header files. I want to compile my program such that I can run it as a stand-alone .exe. The error is: error LNK2001: unresolved external symbol _cbDeclareRevision@4. The header files are in the headers folder and the program works in debug configuration, I'm a little confused why it does not work when in release configuration. Is there another way to create a stand-alone executable function of my program? In addition, my program calls GnuPlot using the system() command. GnuPlot then opens a .txt that plots my data from a .dat file. I would like the ensuing plot to be maximized on the screen. I was wondering if anybody knew a system() command to maximize the current window, or, although not related to this forum, a command for GnuPlot that would maximize or full screen the plot. My program reads data from an analog-digital converter and then plots the data and does a simple analysis. It is a basic program that I am working the kinks out on before I try to implement a real time system. Any help is appreciated, this will be my first real time program.
Code:
#include <iostream>
using std::cerr;
using std::endl;
#include <windows.h>
#include "..\cbw.h"
#include <stdio.h>
#include <conio.h>
#include <fstream>
using std::ofstream;
#include <cstdlib>
using namespace std;
int main ()
{
int I, J;
int peak;
int trough;
int L=0;
int sum=0;
int ave=0;
int BoardNum = 0;
int ULStat = 0;
int LowChan = 0;
int HighChan = 0;
int Gain = BIP5VOLTS;
long Count = 4001;
long Rate = 500;
WORD ADData[4001];
unsigned Options=CONVERTDATA;
float RevLevel = (float)CURRENTREVNUM;
ULStat = cbDeclareRevision(&RevLevel);
cbErrHandling (PRINTALL, DONTSTOP);
printf ("Demonstration of Scanning Data\n");
ULStat = cbAInScan (BoardNum, LowChan, HighChan, Count, &Rate,Gain, ADData, Options);
for (J = 0; J < 1; J++)
{
peak=ADData[0]-2046;
trough=ADData[0]-2046;
ofstream outdata;
outdata.open("Data.dat");
for (I = 0; I < 2000; I++)
{
outdata<<""<<I<<" "<<ADData[I*2+J]-2046<<""<<endl;
sum=sum+(ADData[I*2+J]-2046);
if (ADData[I*2+J]-2046>peak)
{
peak=ADData[I*2+J]-2046;
}
if(ADData[I*2+J]-2046<trough)
{
trough=ADData[I*2+J]-2046;
}
L=L+1;
}
outdata.close();
ave=sum/L;
printf("\n\nThe number of collected data values is %d",L);
printf("\nThe sum of the data values is %d",sum);
printf ("\nThe average is %d",ave);
printf("\nThe peak value is %d",peak);
printf("\nThe trough value is %d",trough);
system("wgnuplot.exe activator.txt");
}
_getch();
}