Error List

This is a discussion on Error List within the C++ Programming forums, part of the General Programming Boards category; Code: -- Error# 1 c:\projects\lm\lm\Parameter.h(53) : error C2872: 'Random' : ambiguous symbol 1> could be 'c:\projects\lm\lm\Random.h(7) : Random' 1> or ...

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    11

    Error List

    Code:
    -- Error# 1
    c:\projects\lm\lm\Parameter.h(53) : error C2872: 'Random' : ambiguous symbol
    1>        could be 'c:\projects\lm\lm\Random.h(7) : Random'
    1>        or       'c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll : System::Random'
    -- Error# 2
    c:\projects\lm\lm\Parameter.h(66) : error C2872: 'Random' : ambiguous symbol
    1>        could be 'c:\projects\lm\lm\Random.h(7) : Random'
    1>        or       'c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll : System::Random'
    -- Error# 3
    1>c:\projects\lm\lm\ParameterList.h(19) : error C2061: syntax error : identifier 'ifstream'
    Error# 4
    1>c:\projects\lm\lm\Neuron.h(17) : error C2143: syntax error : missing ';' before '*'
    1>c:\projects\lm\lm\Neuron.h(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\projects\lm\lm\Neuron.h(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    Error# 5
    1>c:\projects\lm\lm\Neuron.h(35) : error C2872: 'Random' : ambiguous symbol
    1>        could be 'c:\projects\lm\lm\Random.h(7) : Random'
    1>        or       'c:\windows\microsoft.net\framework\v2.0.50727\mscorlib.dll : System::Random'
    1>c:\projects\lm\lm\Neuron.h(71) : error C2061: syntax error : identifier 'ofstream'
    1>c:\projects\lm\lm\Neuron.h(94) : error C2061: syntax error : identifier 'ifstream'
    1>c:\projects\lm\lm\Neuron.h(96) : error C2061: syntax error : identifier 'ofstream'
    1>c:\projects\lm\lm\Neuron.h(97) : error C2061: syntax error : identifier 'ifstream'
    1>c:\projects\lm\lm\RString.h(7) : fatal error C1083: Cannot open include file: 'math': No such file or directory
    1>Build log was saved at "file://c:\Projects\LM\LM\Debug\BuildLog.htm"
    1>LM - 12 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    I am trying to run a program but it has so many errors. I tried to google the error but it did not help much...
    Error# 1
    Code:
    class Parameter{
    	//##ModelId=3F6DA23701AF
    	int type;
    	//##ModelId=3F6DA23701E1
    	Random* rnd;
    	char name[20],distr[20];
    	//##ModelId=3F6DA23701E5
    	double val[20];
    	//##ModelId=3F6DA237021C
    	int nextValue;
    	//##ModelId=3F6DA237021D
    	double percent;
    Error# 2
    Code:
    public:
    	//##ModelId=3F6DA2370253
    	Parameter(){rnd=new Random();nextValue=0;nextPar=NULL;percent=0;};
    
    	//##ModelId=3F6DA2370254
    	void setName(char *parName){
    		strcpy(name,parName);
    Error# 3
    Code:
    int type;
    	//##ModelId=3F6DA23700D2
    	int readNext(ifstream in,char * tmp);
    Error# 4
    Code:
    ifstream *in;
    Code:
    Random * rnd;
    It overall seems that the complier is not able to fix the pointer assigned to rnd ....I have attached the intialization of rnd too...
    Code:
    #include "Random.h"
    #include <stdlib>
    #include "math.h"
    
    using namespace System;
    
    //##ModelId=3F6DA2360295
     double Random::rnd01(){
    	//double rnd01 () {
    If u want more segments of the code..please let me know

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,354
    The answer is right there in the error messages. You are using namespace System, and that namespace has a Random symbol declared. This causes an ambiguity when you refer to Random using no namespace qualifier. You need to explicitly specify the namespace of the symbol you want. Or get rid of "using namespace System" and specify System:: explicitly when you access its members.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,773
    I am guessing that this is C++, so this thread has been moved to the C++ programming forum.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    11
    Error#1 fatal error C1034: stdafx.h: no include path set

    After solving all the errors i am getting this error... I found an online solution on
    http://msdn.microsoft.com/en-us/libr...36(VS.80).aspx
    but it does not work ... what could be the possible solution to this problem....

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21