473,320 Members | 1,881 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.

compiler error: cannot convert type void to string

I call method Foo(string s);

with Foo("foo"+"bar");

what's the deal here?
Oct 8 '08 #1
6 4424
On Oct 8, 4:20*pm, puzzlecracker <ironsel2...@gmail.comwrote:
I call method Foo(string s);

with Foo("foo"+"bar");

what's the deal here?
My guess is that you're doing something like:

string x = Foo("foo" + "bar");

If not, please show a short but complete program which demonstrates
the problem.

Jon
Oct 8 '08 #2
On Oct 8, 11:20 am, puzzlecracker <ironsel2...@gmail.comwrote:
I call method Foo(string s);

with Foo("foo"+"bar");

what's the deal here?
post your complete code

I do nt know if you are doing
string s = Foo("foo"+"bar");
or
Foo( Foo("foo"+"bar") );
Oct 8 '08 #3
On Oct 8, 11:20 am, puzzlecracker <ironsel2...@gmail.comwrote:
I call method Foo(string s);

with Foo("foo"+"bar");

what's the deal here?
In any case your method is returning void, it should be returning
string
Oct 8 '08 #4
On Oct 8, 11:22*am, "Jon Skeet [C# MVP]" <sk...@pobox.comwrote:
On Oct 8, 4:20*pm, puzzlecracker <ironsel2...@gmail.comwrote:
I call method Foo(string s);
with Foo("foo"+"bar");
what's the deal here?

My guess is that you're doing something like:

string x = Foo("foo" + "bar");

If not, please show a short but complete program which demonstrates
the problem.

Jon
I just call a method, with concatenation of two strings,that takes
string parameter. That's all.

BTW what is wrong with string x = Foo("foo" + "bar"); ?
Oct 8 '08 #5
On Oct 8, 8:43*am, puzzlecracker <ironsel2...@gmail.comwrote:
On Oct 8, 11:22*am, "Jon Skeet [C# MVP]" <sk...@pobox.comwrote:
On Oct 8, 4:20*pm, puzzlecracker <ironsel2...@gmail.comwrote:
I call method Foo(string s);
with Foo("foo"+"bar");
what's the deal here?
My guess is that you're doing something like:
string x = Foo("foo" + "bar");
If not, please show a short but complete program which demonstrates
the problem.
Jon

I just call a method, *with concatenation of two strings,that takes
string parameter. *That's all.

BTW what is wrong with *string x = Foo("foo" + "bar"); ?
can you please post the signature of method please?

I guess it is

public/private void Foo(string)
-Cnu
Oct 8 '08 #6
On Oct 8, 4:43*pm, puzzlecracker <ironsel2...@gmail.comwrote:
I just call a method, *with concatenation of two strings,that takes
string parameter. *That's all.
I'm afraid I don't believe you. Please post a short but complete
program that demonstrates the problem.
BTW what is wrong with *string x = Foo("foo" + "bar"); ?
If Foo is declared to be void, then you can't assign a string variable
based on the result, because there isn't one.

Jon
Oct 8 '08 #7

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

Similar topics

19
by: Alf P. Steinbach | last post by:
// As usual the error message directs one to the report the bug. // // And as usual there is absolutely no way to do so without paying for // the privilege... // // Or using three or four hours...
19
by: Canonical Latin | last post by:
"Leor Zolman" <leor@bdsoft.com> wrote > "Canonical Latin" <javaplus@hotmail.com> wrote: > > > ... > >But I'm still curious as to the rational of having type >...
2
by: George Bell | last post by:
The compiler(gcc) gives me this error faxGettyApp.c++:596: ANSI C++ forbids implicit conversion from `void *' in assignment make: *** Error 1 on this code void...
13
by: Neil Zanella | last post by:
Hello, I wonder whether anyone has ever come across the following g++ compiler error message. I don't recall ever seeing it before. I solved my problem but I am still not sure about what this...
4
by: KK | last post by:
Hello all, I have class 'atr' which is based on templates. My idea was to initialize it two scenarios 1. std::string case 2. other data types I have defined the Init for the above different...
1
by: keithb | last post by:
This application works without error in the development environment using the VS web server. When I publish the site to my IIS 6.0 server, I get this error at runtime when I open the Change...
3
by: maya | last post by:
am following "asp.NET Unleashed", by Stephen Walther (a SAMS book.. covers .net 1.1 though..) on one of his examples (ch 2) am getting compilation error.. code: <script Runat="Server"> void...
13
by: murphman | last post by:
I recently decided to do the right thing & write accessor functions for my class member variables instead of having them public and introduced a rather nasty bug. The class below shows the error -...
0
by: erik.erikson | last post by:
I am getting a compiler error that I can't well explain or even understand the origin of (though I boiled it down close...). Below is a bare-bones example. What I am doing is defining the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.