fatal error C1189: #error
Dan Digman
digman.6 at msn.com
Tue Jul 30 20:18:20 EDT 2002
Hello Help -
I am new to Visual C++ and have compiled a few resource books to help in the learning process. However, this problem - as stated by an earlier user - I have been unable to sole.
*** Program ***
// Program Random Sequence Number Generator
#include <cstdlib>
#include <iostream>
#include <ctime>
int main()
{
std::cout << "Random Sequence Number Generator (RSNG). \n";
std::cout << "Written by Dan Digman on 26-July-2002 using C++. \n \n";
std::cout << "Input number of Replications (reps) ... ";
int reps;
std::cin >> reps;
std::cout << "\n";
std::cout << "Input number of treatments per replication (rep) ... ";
int treats, limit;
std::cin >> treats;
limit = treats + 1;
std::cout << "\n \n";
// Allocate memory for the array
int* intArray;
intArray = new treatnum[treats];
// Print out the current replication number
while (int c <= reps) {
std::cout << "Replication #%d \n",c;
// Get random numbers
int d = 1;
while (d <= treats) {
rnumber = random(treats) + 1;
if treatnum[d] < limit {
std::cout << "%d ",rnumber;
treatnum[d] = limit;
d++;
}
}
// Initialize the array
int i = 0;
while (i < treats) {
treatnum[i] = 1;
i++;
}
std::cout << "\n \n";
c++;
}
}
// Generate a random number and return it to main
int random(num)
{
int num;
return static_cast<int>((num*static_cast<long>(rand()))/(RAND_MAX+1));
}
*** End Of File ***
When Compiled, I receive the following message ...
--------------------Configuration: crand - Win32 Debug--------------------
Compiling...
crand.c
c:\program files\microsoft visual studio\vc98\include\eh.h(32) : fatal error C1189: #error : "eh.h is only for C++!"
Error executing cl.exe.
crand.obj - 1 error(s), 0 warning(s)
*** End of Compile ***
I found a few responses of which I have unsuccessfully tried.
I have also found a few responses from the comp sci dept at Virginia Tech - none of which pertain to this particular error message.
Then I came across a particular response on your site :
You can use the \Tp switch. It tells the compiler that .c files are = C++.
Frankly, I would like to try this to see if it would solve my compiling problems but I have no idea where in the program to implement this statement or how to use it.
Thank you in advance for your help in this matter...
-Dan
digman.6 at osu.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/galib/attachments/20020730/94059d0d/attachment.htm
More information about the galib
mailing list