I have just started to learn about how C++ works however it seems that any source code I get I can not get to compile. Even when I try to copy the tutorials in their own project I get errors. For example, when I want to follow along with this, http://www.directxtutorial.com/Lesson.aspx?lessonid=11-1-3 Visual Studio gives me back tons of errors. http://gyazo.com/7131e8d21a8aa5c44c68f3e846da7921 Can anyone tell me how to fix this? I have tried many different OpenGL and DirectX tutorials and none of them seem to work (on several computers). I then tried Code Blocks and got that doesn't seem to work either.
You need to do some changes in project settings.
Go to project properties->General->Character Set, use the "Use Unicode Character Set" and then compile the project. It will work perfectly.
Related
I was trying to write a c++ program, but when i went to compile it all my compilers had disappeared from the menu. I know theyre installed as ive used them before, but for some reason they arent showing up in vscode. The only thing thats showing up now is "cl.exe" before i also had the option of g++ and nothing has changed with the system so im very confused as to why this is.
I've tried restarting my computer, restarting vscode, checking if my compilers have somehow uninstalled themselves, but they all seem to be there. So i dont know why theyre missing.
so I recently got started with vscode and working with the c++ project when I noticed that some of the errors aren't displaying. Also, the program would run fine on vscode but when used it on repl.it it would show some critical errors like "signal: Aborted (core dumped)" and it would tell me at which line it encountered that problem.
Looking at vscode however it seems to me it doesn't detect subtle errors such as when I have a function that would return a string and I purposely return 0 instead of a string it still considers it a valid operation. I don't know if the issue is the IntelliSense or some error-checking aspects, but one thing for certain I know visual studio would show this with a warning sign that would appear on the number line.
I do have the squiggly lines enabled for errors and it does show errors if I have some keyword typed incorrectly. What I want to know is where the c++ would fail to run and tell me before the run, or even during runtime.
screenshot of no error when there should be
VSCode is pretty intelligent, and in theory it should be able to have all the IntelliSense that those other IDEs have. However, that does not come out of the box. What you need to do it install some extensions specific to the programming / scripting languages that you work with. For example, for C++ you can download C/C++ extension developed by Microsoft.
After installing the needed extensions please read some documentation and tweak them as needed.
Your IntelliSense issues will be solved.
I've figured out that it wasn't displaying the crash errors because my installation of msvc was flawed. I downloaded msvc again and used the Pacman commands to install all the necessary files and now my crash errors show. However, some syntax errors still don't show like int main {... without a closing curly brace. This code still runs, and the error is picked up during the run time. I would've expected the error to be highlighted before the run.
I'm using Xcode 3.0 on a PowerBook G4. I needed to test some code to see how it runs on a big endian host. I already had it set up to go so got it out to test.
I first created an empty project and added my binary as a custom executable as well as loading in some source files. This seemed to be working fine. The code is a C++ terminal application and I had already setup a Makefile with CMake.
In the beginning I set up some breakpoints and started up the debugger. And it worked well. Stopping at my breakpoints. But then something happened that I don't know what and it started ignoring them.
I setup a new project like before and started from scratch again. Loaded the debugger. And once again it ignored them!
So then I managed to get CMake (2.8.12) to generate an Xcode project file. Which didn't go too easy as it didn't know what compiler I had. Looks like I stumbled onto another bug there. I eventually got past it by going between the CMake GUI and terminal.
I then closed all windows in Xcode and quit it. I then opened up the new project to start afresh. I set up some new breakpoints and loaded up the debugger. The code fell through again but then I realised I didn't set any arguments. So I did that and tried again. It ran through again! I looked up how to reset Xcode prefs and did so. Try again and it keeps ignoring my breakpoints!
I know it's kinda bad to setup an account to ask a question. And I hate to do that. But I'm really over this and don't know what is wrong with it. I've Googled for answers, got some hits here, and tried suggestions like disabling lazy symbols, making sure strip doesn't kill debug symbols and other symbol stuff but none has any affect. I've wasted hours trying to fix it instead of testing code I need too.
What's disconcerting is that no source is loading into the [GDB] debugger either. I actually forced it to stop by doing an implicit read from location zero in my source. And even this wasn't right. It didn't even load up the source but just gave me a disassembly. Even though I had it set to show only source. There's something wrong with it. :-?
Well thanks for any help. I don't know if I'm getting old or what. But this is getting as annoying as a small hidden bug in code that brings the whole house down! ;-)
Okay so basically I'm working on recursion. And I recently switched from a mac to a PC, so I'm now using eclipse instead of XCode for programming c++. now this has happened to me a couple times, and I still have no idea why its doing it. When this happens I do not get an error code, I've searched far and wide for this solution but haven't found one yet, so i'm hoping you guys could help. So everything was going great (almost finished), but i realized a bug, so I fix it, then I save it, then I build it, run it, then it doesn't build properly (i'm assuming), like it didn't build my new code, it just rebuilt my old code and ran that, im using MinGW, I've also tried to import my old code via copy and paste, but it did the same thing, please help.
*let me know if I left anything out that might be needed to know
**update on my project file it does have a error sign on it, but there isn't one in my code
***update update I looked through the errors and found that it doesnt have permission to open output file "recursive.exe" (my project name)
OK solution: run eclipse as admin
I have been trying out using Eclipse CDT for a course I am taking. Previously I have been using Visual Studio Express but since that requires me to be online and I have to use the IDE+compiler offline, I switched to Eclipse + Cygwin GCC.
Now everything was working prefectly, until I got an error about file paths in my make file. After reading some of the posts online, the issue seemed to be that Cygwin's make does not resolve absolute Windows file paths because of the ':' symbol and confuses it with a new target definition. The proposed fix was to download a fixed make file. I diligently did so and the programs would compile fine.
But after I went into the first debug session, everything froze. I aborted eclipse and tried a clean build but now the compilation wont happen AT ALL, which is very weird for me.
I can't find a post for a similar problem so I am really stuck now. I was currently working the assumption that my CDT may be corrupt or something so I downloaded Eclipse Luna just today and tried building using that, but no joy. Even a fresh project in a new workspace wont compile.
Appreciate the help in advance.
Did you try redownloading Eclipse? Sometimes Eclipse gets a fatal error glitch that makes it unable to compile anything. I've had this problem before, the only way i was able to fix it was to uninstall and re download the latest version. If this doesnt work, try switching to Bloodshed Dev C++ or codeblocks.
So it seems like an issue with the new make (v3.80). upgating it to v4.08 fixed the issue of not building.
Version 4.08 however does not fix the Windows file paths not being recognized properly and treated as a target definition. I am still getting the multiple target patterns. stop error.
EDIT: Found this on Stack overflow to solve the issue... should have searched better previously.
Very simple application fails with "multiple target patterns" from Eclipse