How do I compile and link a .c file using vim in linux, so that I can execute it?

Yay a fellow Linux dev!

Add me on steam if you want direct help and tips, for that particular question you can easily just write a command like

Code:

:!gcc -o main main.c test.c blah.c

but you should really to look into makefiles, it's a more standard way of compiling your projects. Vim has a handy command "make" (or "mak" for short) that runs the local makefile; then lets you zoom to errors or warnings that the compiler produces.

I have more tips on how to make your life easier! Add me as a friend on steam as posting them all on here would be lengthy.

I have a problem with my Visual Studio.
I recently switched from Visual Basic to C#. When I try to inherit from an other class in C#, I can't see the Methods I can override.
In Visual Basic I could simply choose a Method of the Base-Class from a Dropdown-Menu I wanted to override.

I have a problem with my Visual Studio.
I recently switched from Visual Basic to C#. When I try to inherit from an other class in C#, I can't see the Methods I can override.
In Visual Basic I could simply choose a Method of the Base-Class from a Dropdown-Menu I wanted to override.

Is this possible in Visual C#, too?

Type in "public override " and intellisense brings up a list of methods in the base class that can be overridden (has the "virtual" keyword)

Ok so I made this little random dice roller. You enter in a high number (such as 20), and it will pick a number from 1 to 20. I even set it up so that it tells you if you roll a critical or not. Anyway, I want to ask about entering in things that aren't numbers. If I enter in a letter or symbol, the program goes haywire and starts spewing stuff out.

Could you maybe put that into simple terms for me? I'm still quite new to C++

well im an idiot and also dont know c++ and this is probably worst way possible but cant you just put try - catch in dice_rnd function ? you can try rand() % high + 1 and if it fails return something else

#include <iostream>
int main()
{
int num;
std::cout << "Enter a number: ";
// When you use cin to pipe a value into a variable, it can return true or false.
// In this case, if we try to put a non-number value into 'num', it will return
// a value of false, so the while loop will execute its block of code
while(!(std::cin >> num))
{
std::cout << "That isn't a number!" << std::endl;
// These two lines discard whatever might be left over in std::cin
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
std::cout << "Enter a number: ";
}
// If we ever break out of the while loop, it's because the user entered a number
std::cout << "The number you entered was: " << num << std::endl;
return 0;
}

#include <iostream>
int main()
{
int num;
std::cout << "Enter a number: ";
// When you use cin to pipe a value into a variable, it can return true or false.
// In this case, if we try to put a non-number value into 'num', it will return
// a value of false, so the while loop will execute its block of code
while(!(std::cin >> num))
{
std::cout << "That isn't a number!" << std::endl;
// These two lines discard whatever might be left over in std::cin
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
std::cout << "Enter a number: ";
}
// If we ever break out of the while loop, it's because the user entered a number
std::cout << "The number you entered was: " << num << std::endl;
return 0;
}

Yours handles most of the cases, but not all. When user inputs "123asd" then your code would happily get 123 as number and leave the "asd" part hanging in input buffer that would get read the next time you ask for some input.

I once wrote a custom input function for this purpose, which also checks if all input got parsed properly to the end:

Yours handles most of the cases, but not all. When user inputs "123asd" then your code would happily get 123 as number and leave the "asd" part hanging in input buffer that would get read the next time you ask for some input.

I once wrote a custom input function for this purpose, which also checks if all input got parsed properly to the end:
<code snorp>

As part of my wanting to expand my C# knowledge im diving into OGL with OpenTK, I have attempted to re-write some of my utility classes in C# but my FBO class gives me this error, I remember OGL giving an error in C++ when I tried to create an FBO but it would never crash.
This is the error:

The way I do it is that I make all OpenGL "objects" (anything that needs to glGen* and glDelete*) implement IDisposable (make sure to implement it correctly), and in debug mode I throw an exception when it's not properly disposed.

I'm actually planning on replacing this with a better system later on, but it very effectively lets us know when we're leaking OpenGL resources.

The way I do it is that I make all OpenGL "objects" (anything that needs to glGen* and glDelete*) implement IDisposable (make sure to implement it correctly), and in debug mode I throw an exception when it's not properly disposed.

I'm actually planning on replacing this with a better system later on, but it very effectively lets us know when we're leaking OpenGL resources.

This part doesn't compile. You can't compare or assign bools to int variables.
(It's also wrong in the C++ code, it always returns true.)

You should probably just throw an exception if the program isn't linked properly and change the method to void.
Using error codes is very uncommon in .NET, the only place it's used in the framework that I know of is the Dictionary's TryGetValue method.

This part doesn't compile. You can't compare or assign bools to int variables.
(It's also wrong in the C++ code, it always returns true.)

You should probably just throw an exception if the program isn't linked properly and change the method to void.
Using error codes is very uncommon in .NET, the only place it's used in the framework that I know of is the Dictionary's TryGetValue method.

Do you know about a java library used for image (texture) loading? I have read that the native ones are not good but the only alternative are imagemagick, that is a C wrapper, as far as I know. If anyone know about something else I would like to know.

I am gonna use it to develop an andriod application, but the simulator is damn slow on my computer.

The ones that apply to other C-family languages as well (such as classes not having any prefices) seem generally pretty nice. Damn, guess they figured after that whole Sys Hungarian mess they actually better make a set of actually great guidelines.