|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Problem with C++ Language I am going through a hectic error in c++ language. I am having some critical errors and problems writing a simple program. The only errors I am getting is "undeclared identifier", but the variable is declared and initialized through user input before it is using it Please help me with this problem |
#2
| |||
| |||
Re: Problem with C++ Language Example doy.cpp: In function `int main()': doy.cpp:25: `DayOfYear' undeclared (first use this function) doy.cpp:25: (Each undeclared identifier is reported only once for each function it appears in.) doy.cpp:25: parse error before `;' token Meaning You used "DayOfYear" in your code, but the compiler has not seen a definition for "DayOfYear". It doesn't know what "DayOfYear" is. Usual Causes You forgot to include the header file that defines the class/struct/function/etc You misspelled the name of the identifier |
#3
| |||
| |||
Re: Problem with C++ Language You cannot nest functions and subroutines in C. Thus, you cannot put the code for Startstr() within main(). You need to do this: Code: char *Startstr(char * s, char * sub); // Function prototype int main() { .. code for main .. } char *Startstr(char * s, char * sub) { .. code for Startstr } |
#4
| |||
| |||
Re: Problem with C++ Language You need to declare s and sub within main(). This is the cause of your error. Code: int main() { char s[50], sub[50]; .. rest of code } |
#5
| |||
| |||
Re: Problem with C++ Language You're using the strstr() function. You need to #include <cstring> instead of <string>. Also, you need to declare that you're using the standard namespace: Code: #include <iostream> #include <cstring> using namespace std; If you don't have that using statement, you will need to qualify all your objects/functions like this: std::cout << "..."; std::cin >> "...."; |
![]() |
|
Tags: language, problem, programming language |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cod black ops Language Problem | dubul | Video Games | 3 | 17-11-2010 12:51 AM |
IE7 and MUI Language problem | ALEXANDRO | Windows Software | 3 | 16-10-2009 04:49 PM |
Problem with Multithreading in C Language | Jagdish Gada | Software Development | 4 | 09-03-2009 02:10 PM |
Problem regarding PHP Programming Language | NetWorm | Software Development | 3 | 02-03-2009 03:04 PM |
F1 2002 pc language problem | Muhammad Waqar | Video Games | 1 | 21-11-2008 07:47 PM |