473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

type

Hi
as im new to C coming from VB.NET where i haven't seen so far
typedeclarations. As I get the error below I don't know what to do.

in main.h:
bool isExtensionSupported(string ext);
and the error:
/src/main.h:164: error: ` string' was not declared in this scope

in main.h I've also included:
# include <string.h>
is that correct? Is it possible to declare any types through a class or
struct like below so I don't need to write anymore float? How would I
access f.ex. y?
class CVector2
{
public:
float x, y;
};
What does the above provide? In VB.NET I only used the predefined types
like int, float etc. I haven't seen the above there...but my career is
still young :-)
Regards Michael
Aug 19 '05 #1
2 1436
Michael Sgier wrote:
Hi
as im new to C coming from VB.NET where i haven't seen so far
typedeclarations. As I get the error below I don't know what to do.

in main.h:
bool isExtensionSupported(string ext);
and the error:
/src/main.h:164: error: ` string' was not declared in this scope

in main.h I've also included:
# include <string.h>
is that correct? Is it possible to declare any types through a class or
struct like below so I don't need to write anymore float? How would I
access f.ex. y?
class CVector2
{
public:
float x, y;
};
What does the above provide? In VB.NET I only used the predefined types
like int, float etc. I haven't seen the above there...but my career is
still young :-)
Regards Michael


Methinks you need a good book. And soon.
Check http://www.accu.org for suggestions.

HTH,
--ag

--
Artie Gold -- Austin, Texas
http://goldsays.blogspot.com (new post 8/5)
http://www.cafepress.com/goldsays
"If you have nothing to hide, you're not trying!"
Aug 19 '05 #2
Michael Sgier wrote:
as im new to C coming from VB.NET where i haven't seen so far
typedeclarations. As I get the error below I don't know what to do.
Just to make sure we're on the same page. We talk _C++_ here. C is
a different language and if you need advice on C, visit comp.lang.c.
in main.h:
bool isExtensionSupported(string ext);
and the error:
/src/main.h:164: error: ` string' was not declared in this scope

in main.h I've also included:
# include <string.h>
is that correct?
No. You need <string>. And after including <string> the name of the
type is 'std::string', not 'string'. What book are you reading that
doesn't explain that?
Is it possible to declare any types through a class or
struct like below so I don't need to write anymore float? How would I
access f.ex. y?
class CVector2
{
public:
float x, y;
};
What does the above provide?
It defines a class named CVector2 (not sure why you'd want 'C' in front
of the name of the class, but hey, who am I to tell you, right?), with
two _members_ 'x' and 'y', each of type 'float'.

You should be able to define an _object_ of type CVector2 now, like this:

CVector2 v;

and that would create an object whose internal data you can access using
the "dot notation":

v.x
or
v.y
..
In VB.NET I only used the predefined types
like int, float etc.
Too bad. VB has user-defined types as well.
I haven't seen the above there...but my career is
still young :-)


So, don't waste any time and find a good book.

V
Aug 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
6
by: S.Tobias | last post by:
I'm trying to understand how structure type completion works. # A structure or union type of unknown # content (as described in 6.7.2.3) is an incomplete type. It # is ...
0
by: Chris Fink | last post by:
When I am consuming a webservice, an object has an undefined value (inq3Type.Call3Data). I do not completely understand why this is happening and apologize for the vague question. My assumption...
1
by: Rob Griffiths | last post by:
Can anyone explain to me the difference between an element type and a component type? In the java literature, arrays are said to have component types, whereas collections from the Collections...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
3
by: john | last post by:
Hi to All To demonstrate: public class MyBaseGenericClass<T> { } public class MyGenericClass1<T: MyBaseGenericClass<T> {
7
by: Sky | last post by:
I have been looking for a more powerful version of GetType(string) that will find the Type no matter what, and will work even if only supplied "{TypeName}", not the full "{TypeName},{AssemblyName}"...
9
by: weirdwoolly | last post by:
Hopefully someone will be able to help. I have written a stored procedure in C++ called from a Java test harness to validate the graphic data types in C++ and their use. I have declared the...
5
by: JH | last post by:
Hi I found that a type/class are both a subclass and a instance of base type "object". It conflicts to my understanding that: 1.) a type/class object is created from class statement 2.) a...
3
by: amanjsingh | last post by:
Hi, I am trying to implement Java Web Service using Apache Axis2 and Eclipse as a tool. I have created the basic code and deployed the service using various eclipse plugin but when I try to invoke...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
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...

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.