|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Dec 2003
Messaggi: 704
|
c++ errore [Linker error] undefined reference to `WinMain@16'
Ciao a tutti.. sto cercando una funzione che simuli la distribuzione di gauss.. e avendo trovato qualcosa che FORSE possa fare al caso mio.. volevo provarla.. ma nella compilazioni mi esce questo errore [Linker error] undefined reference to `WinMain@16' .. che ho fatto?
ecco il codice Codice:
#include <iostream> #include <math.h> #define PI 3.141592654 double max(double a, double b) { if (a>b) return a; else return b; } double min(double a, double b) { if (a>b) return b; else return a; } // replicates Sgn as in visual basic, the signum of a real number double sgn(double a) { if (a>0) return 1.; else if (a<0) return -1.; else return 0.; } // standard normal density function double ndf(double t) { return 0.398942280401433*exp(-t*t/2); } // standard normal cumulative distribution function double nc(double x) { double result; if (x<-7.) result = ndf(x)/sqrt(1.+x*x); else if (x>7.) result = 1. - nc(-x); else { result = 0.2316419; static double a[5] = {0.31938153,-0.356563782,1.781477937,-1.821255978,1.330274429}; result=1./(1+result*fabs(x)); result=1-ndf(x)*(result*(a[0]+result*(a[1]+result*(a[2]+result*(a[3]+result*a[4]))))); if (x<=0.) result=1.-result; } return result; } |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Apr 2003
Città: Genova
Messaggi: 4741
|
potrebbe essere perchè in quel codice manca l' entry... prova ad aggiungere int main() o int WinMain()
__________________
Jappilas is a character created by a friend for his own comic - I feel honored he allowed me to bear his name Saber's true name belongs to myth - a Heroic Soul out of legends, fighting in our time to fullfill her only wish Let her image remind of her story, and of the emotions that flew from my heart when i assisted to her Fate
Ultima modifica di jappilas : 05-02-2007 alle 19:22. |
![]() |
![]() |
![]() |
#3 |
Senior Member
Iscritto dal: May 2006
Città: Wursteland
Messaggi: 1749
|
O crei una libreria con ld sennó aggiungi il main che chiama la funzione. Se é solo per testare meglio la seconda. Ma é windows, io di piú non so aiutare.
__________________
Nintendo WIII 4d Turbo Intercooler - Sestium X 666 99,312 GHz - 6.984 Ram Σ(9999) MHz - HDD SATA 97e^(10) bytes 93³ rpm - ATI biberon X900z ∞Mb - Win Eight SP (1 > yours) 16 Valve |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 06:44.