I've tried everything, and I just can't get my program to compile in visual basic. Someone tell me what I'm doing wrong?

see attached image, are the includes in the wrong spot or WAT!??!?!

Dani AI

Generated

This is a classic language-vs-IDE mixup — something several replies already hinted at. and correctly pointed to the wrong compiler, and added useful context about VB and classes. Quick, reliable signals for identifying the language are file extensions and syntax tokens: #include, {} and ; or using/namespace usually mean a C-family file (.c, .cpp, .h, .cs); Imports, Option Explicit, End If and extensions like .vb or .frm/.bas/.cls point to Visual Basic.

Common troubleshooting checklist:

  • Identify the source language (check the file extension and the top-of-file tokens).
  • Open or create the matching project type in the IDE (Visual C++/C# project for C-family languages, a VB.NET project for .vb, or the VB6 IDE for classic VB).
  • Use the matching compiler/toolchain (native C++ uses the C++ compiler, VB.NET uses the VB compiler that targets the CLR, VB6 uses its own compiler). Renaming a file does not make it compileable by the wrong compiler.
  • For mixed-language needs, keep code in separate modules: build native C++ into a DLL or COM component, or wrap native code with a C++/CLI layer for .NET consumers; classic VB consumes COM/ActiveX or exported DLL functions.
  • Always read the first compiler error message. The first error usually shows the real mismatch; later errors are often just fallout.

Notes and cautions: classic VB supports class modules but does not offer class inheritance the way VB.NET or C# does. Automatic language converters exist but are unreliable for nontrivial projects — a managed wrapper or a manual port is safer. Given the attachment name (c++vbfail.jpg), this appears to have started as a joke, yet the practical fix for "won't compile" problems is almost always to match the source language to the correct project and compiler.

Recommended Answers

All 8 Replies

You're kidding right?

Thats not VB classic source code to begin with.

Thats .net or C # and it sure will not compile in VB 5 or 6

hehe sorry I thought I was in gcc. My bad

Member Avatar for Member #268003

It's Simple Visual Basic Compiler won't compile C++ code you need to change your code to VB or use Visual C

What the hell?
Is this a joke or something?

Thats VISUAL BASIC.
The code is C++!

ok but wait, wat's the diff? o i no, it's that vb can't use classes rite? not OOP? ic

ps. look at the filename of the attachment, of course it's a joke :)

Ah right i didnt get it because when i downloaded it in IE it gets called

"c%2B%2Bvbfail.jpg"

which confused me

ok but wait, wat's the diff? o i no, it's that vb can't use classes rite? not OOP? ic

ps. look at the filename of the attachment, of course it's a joke :)

Man oh man where do I start?

First off, its the syntax that is different between C++ and VB. For example in C it is the parens() that define or contain an if or class where as in VB its a whole differt declaration...

Private MySub()
If ThisIsTrue = True Then
End If
End Sub

Public MyFunction(Arguement1 As String, Arguement2 As Integer) As Byte()
End Function

Now, VB can use classes especially since to add a class it is as simple as a couple of mouse clicks but "Classic VB" or versions 4/5/6 do not support true inheritance and VB is or can be OOP if you know what you are doing and you know what OOP is.

As for your joke, your file has been renamed to so some if not all of us probably don't get it.

oh, when I look at it, it says "c++vbfail.jpg".

and yeah, I know, I'm pretty fluent in VB but new in C++, I just wanted to see how people responded. Pretty awesomely, if you ask me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.