473,800 Members | 2,586 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error c2065

3 New Member
Hi!
i cant get this code to work, I get error c2065, undeclared identifier for some reason don´t really know why...
this results in error C2146: syntax error : missing ';' before identifier 'Sorter'
and error C2065: 'Sorter' : undeclared identifier....
furthermore, I am not sure that my sorter will work (later problem =))
And I hope here is a kind soul that can help me out =)

the code:
#include <iostream>
#include <string>
#include<cstdli b>
using namespace std;

int main(){
ArraySorter Sorter; // <-- c2065





return 0;
}

#pragma once
#include<string >

class ArraySorter
{
public:
ArraySorter(voi d);
void ISort(char *[], int );
~ArraySorter(vo id);
private:

};
------------------------------------------------------ArraySorter.cpp
#include "ArraySorte r.h"
#include<string >

ArraySorter::Ar raySorter(void) {
}
void ArraySorter::IS ort(char* skivor[], int antalSkivor){

int itr;
for(int i=1;i<antalSkiv or;i++){
//string name(skivor[i]);
char *temp= skivor[i];
itr=i-1;
while(strcmp(sk ivor[itr], temp)>0 && itr>=0){
skivor[itr+1]=skivor[itr];
itr--;
}
skivor[itr+1]=temp;
}

}

ArraySorter::~A rraySorter(void )
{
}
Dec 30 '09 #1
4 3612
newb16
687 Contributor
you need to have this
class ArraySorter
{
public:
.....
};

included somewhere before you instantiate ArraySorter.
#include "arraysorter.h" , most likely.
Dec 30 '09 #2
backen
3 New Member
Hi!
i have in ArraySorter. this;
#pragma once
#include<string >

class ArraySorter
{
public:
ArraySorter(voi d);
void ISort(char *[], int );
~ArraySorter(vo id);
private:

};
and I have
#include "ArraySorte r.h"
in ArraySorter.cpp .
that is what you ment?
Dec 30 '09 #3
manontheedge
175 New Member
#include <iostream>
#include <string>
#include<cstdli b>
using namespace std;

int main(){
ArraySorter Sorter; // <-- c2065





return 0;
}
you HAVE TO include the header in the file where you have 'main()' in order to use your class. Main() has no idea what you're doing without having the header for your class included.
Dec 30 '09 #4
backen
3 New Member
aha!
thanks, that solved it!
Dec 30 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
5088
by: Equilibrium | last post by:
what did I wrong with the program ? (use VC++) /* Using if statment, relational operators, and equality operators */ #include<stdio.h> int main() { printf("Enter two integers, and I will tell you\n"); printf("the relationships they satisfy: ");
4
2048
by: yanyo | last post by:
hi, im trying to figure out whats the problem with this program i get a runtime error but i dont see where the problem is i tried changing declaration but nothing if somrbody can try this on their compiler to make sure is not a compiler compatibility problem. #include<stdio.h> #include<math.h> char menu_action(void);
2
1841
by: VicVic | last post by:
Hello, I have an old project, built with VC++. Now need to be compiled in Visual Studio .Net 2003. The project is going to build a DLL. When i try to compile the project, i got the following errors: c:\thepath\aaa.cpp(890): error C2065: 'm_nBackStyle' : undeclared identifier c:\thepath\aaa.cpp(890): error C3861: 'm_nBackStyle': identifier not found, even with argument-dependent lookup
2
3384
by: teddybyte | last post by:
my script below is: #include "stdafx.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
2
3934
by: Nick | last post by:
I'm learning C++ and ran into a compile error using Visual C++ 2005 Express on the following example program (located at http://www.cplusplus.com/doc/tutorial/templates.html): // template specialization #include <iostream> using namespace std; template <class T> class container {
25
4028
by: notahipee | last post by:
I have been trying to cin an number from 0 to 9 with a leading 0. For example 00 or 07. I was using a switch case. switch (int) { case 01: break; case 02: break;..... My problem arises at 08 and 09 because they are not octal. Is there any way to coerce the input variable to decimal despite it having a leading zero .
6
38080
by: muby | last post by:
Hi everybody :) I'm modifying a C++ code in VC++ 2005 my code snippet void BandwidthAllocationScheduler::insert( Message* msg, BOOL* QueueIsFull,
4
6026
by: VikrantS | last post by:
Hi, I am migrating code from VS 6.0 to VS2008. The Code compiles in VS 6.0 but gives the following errors when compiled in VS 2008, --- \Program Files\VC\atlmfc\include\afxcmn.inl(376) : error C2065: 'TVM_GETLINECOLOR' : undeclared identifier E:\Program Files\VC\atlmfc\include\afxcmn.inl(378) : error C2065: 'TVM_SETLINECOLOR' : undeclared identifier E:\Program Files\VC\atlmfc\include\afxcmn.inl(394) : error C2065: 'TVIF_STATEEX' :...
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10507
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10279
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10255
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7582
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4150
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2948
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.