473,320 Members | 1,884 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,320 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 1433
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.