Visual studio doesn't recognize Allegro 5 add ons - visual-studio

I am new to Allegro 5 and Visual Studio... I'm trying to run a simple code:
#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>
int main(){
al_init();
al_init_image_addon();
return 0;
}
And it returns an error:
LNK2019 Unrecognized external symbol __imp__al_init_image_addon referred in function _main
I already install Allegro5 from NuGet packages and enable add ons on project properties... but it still doesn't work...
Please if anyone has a solution, tell me, because I am breaking my head thinking it xD
If I delete the line al_init_image_addon(); it works perfectly and also U can create and destroy displays, for example... but the add ons simply doesn't work.

Kudos for using allegro :)
I think I once had a similar issue, try this:
Make sure you have the Allegro and AllegroDeps (both by allegro developers installed via nuget).
Right click on your 'project' (not solution) in the 'Solution Explorer' (normally on the right hand side) and go Properties.
There should be an 'Allegro 5' section:
Be sure to toggle 'Image Addon' to 'Yes' (and depending on what other addons you want turn them to yes too).
Hope this helps :)

Related

Installing Allegro 5

Can someone please walk me through installing Allegro 5 or guide me in a direction to go to who can show me how to install it?
I did a little googling, researching on how to configure my security settings, so I believe I was allowed to copy over the lib, bin, and include folders over into vc: lib, bin, and include folders. But, now I am struggling with copying over the bin folder into my sysWOW64 in 7:29 of the video.
I cannot seem to solve the access denied message for the life of me. I am using a Windows 10 64 bit operating system along with visual studio 2015. And to solve my Allegro 5 installation problems, I have referenced the video https://www.youtube.com/watch?v=IZ2krJ8Ls2A to install allegro5.
I really want to start game programming. But the biggest challenge is: by- passing my computers security to grant me access to install the Allegro 5 bin items into my sysWOW64 folder.
OK so all the guides on the net seem to be outdated or seem to forget that the Official Site has recent and modern binaries ready for download. So here is how to setup Allegro:
Assumptions
First thing first, I will be using the Unstable branch, 5.1, since it is the one that has the new binaries. And Second, I will be using Visual Studio 2013 but it should be exactly the same for Visual Studio 2015 (Step 1 below has the only difference in the process you might encounter).
Step 1
We will download Allegro 5 direct from the Gna! repository. Here you select the file depending on what you have and what you want to do.
This directory has 4 files, in my case, I will download allegro-msvc2013-x86-5.1.12.zip and you will download allegro-msvc2015-x86-5.1.12.zip. Select the x64 version only if you know what you are doing.
Step 2
When it finishes downloading, extract the contents somewhere that is easy to reach and that you will not move, such as the root of your hardrive or inside Documents. I'll go with the root, usually drive C:. After the extraction, you should have a folder in C:\allegro\ with the following content:
allegro\
|-bin\
|-include\
|-lib\
It is important you remember where you extracted the files as setting the environment correctly depends on its ability to locate this path.
Step 3
Here we tell Visual Studio how to use Allegro. Open Visual Studio and create a new C++project/open the project you want Allegro to be used in. With the project open, right click its name on the solution explorer and open Properties then:
At the top, where it says something like Configuration: Active(Debug), select All Configurations.
On the left menu select C/C++ -> General. On this configuration page, select Additional Include Directories and edit it to containC:\allegro\include\ in its text field.
On the left menu select Linker -> General. On this configuration page, select Additional Library Directories and edit it to contain C:\allegro\lib\ in its text field.
Click on Apply at the bottom, but don´t close the window yet.
Back at the top, select the Debug configuration.
On the left menu select Linker -> Input. On this configuration page, select Additional Dependencies and edit it to contain allegro_monolith-debug.lib in its text field.
(Optional)On the left menu select Linker -> System. On this configuration page, select SubSystem and change it to Console from the drop-down box. This will give you a working terminal window in Debug mode to which you can write ...err... debug stuff ;)
Click on Apply at the bottom, but don´t close the window yet.
Back at the top, select the Release configuration.
On the left menu select Linker -> Input. On this configuration page, select Additional Dependencies and edit it to contain allegro_monolith.lib in its text field.
(Optional)On the left menu select Linker -> System. On this configuration page, select SubSystem and change it to Windows from the drop-down box. This will prevent the Terminal window to appear on Release versions of your program.
Click on Apply then OK, this will close the Property Pages of the project and should prepare it for Allegro.
Step 4
This is the part where we test everything worked...(or not, see next step after error)
Create a *.cpp file or use the one where your main function is located and change it to this small test program: (I give away all my rights to it and place it under public domain)
#include "allegro5\allegro5.h"
#include <iostream>
int main(int argc, char** argv)
{
al_init();
ALLEGRO_DISPLAY *display = nullptr;
al_set_app_name("Hello World from Allegro 5.1!");
display = al_create_display(640, 480);
if (display == nullptr)
{
std::cerr << "Well, something is not working..." << std::endl;
al_rest(5.0);
return EXIT_FAILURE;
}
al_clear_to_color(al_map_rgb(255, 255, 255));
al_flip_display();
al_rest(5.0);
return 0;
}
If after compiling and running you get a blank window that closes in 5 seconds then Allegro is ready! If not, post your error message and I'll take a look at what happened.
Step 5
Where we solve the missing DLL error upon execution...
So the program should have compiled correctly and Visual Studio will now attemp to run it. Upon starting, the following might appear:
The solution is to copy on the Debug folder on the root of your project the allegro_monolith-debug-5.1.dll file, so that it is located beside your program's .exe file. Similarly, on the Release folder you have to copy allegro_monolith-5.1.dll beside that folder's executable. Both of this files should be on the allegro\bin\ directory of the downloaded archive. Keep in mind that you would probably need another dll from the ones I said, but it should also be included on the file you downloaded from Gna!.

Debugging Haxe with HaxeCpp and IntelliJ. DebugSocket not Found

I am currently trying to get the Haxe Debugger working with IntelliJ, using information from This video tutorial and This blog post.
At one point, the tutorial says that a DebugSocket object must be created in the "create" method of the main file. However, when I type this in, I get an unknown symbol error.
From what I understand, the DebugSocket object should be available from the hxcpp library (which I have included). However, the only options I am given if I type new hxcpp. are:
Builder
NekoInit
StaticMysql
StaticRegexp
StaticSqlite
StaticStd
StaticZlib
What am I doing wrong? Have I included the wrong library? Are these tutorials referencing an older version of the library? Is there anywhere I can find comprehensive documentation on how to use the hxcpp debug tools properly?
If this is easier with a flash build then I would consider this.
i haven't gotten hxcpp debugging to work (but i m sure it does). However, i find flash debugging to be easier. I assume you already have the project setup in idea (and isn't just using it as a simple text editor). This is the set of steps i took to get it to work:
Open the project structure (from the menu 'file', then 'project structure')
find the 'modules' section on the left, and select your module, then find the 'haxe' tab.
in the haxe tab, select compile with 'openfl', and target flash.
in the bottom part of the haxe tab, select a flex sdk.
if you don't have flex+air sdk installed, you can easily install it by going to http://www.adobe.com/devnet/flex/flex-sdk-download.html, and http://www.adobe.com/devnet/air/air-sdk-download.html. make sure you remember where you installed it. An alternative place you can find it is via flashdevelop's 'tools', 'install software' menu (which by default installs to your C:/Users/username/AppData/Local/FlashDevelop/Apps/flexairsdk/4.6.0+4.0.0/.
you can add the sdk to intellij by selecting 'SDKs' on the left, and click on the '+', and then select 'flex/air' sdk. You need the flex plugin installed (whcih should be by default).
once you got your debug SDK setup, you can create a run configuration, and debug like you normally do (click on the debug run menu item or toolbar button).
One complication is that on windows, you potentially have a deadlock with haxelib not starting your app, and intellij hanging to wait for it. See https://github.com/TiVo/intellij-haxe/issues/123 - i have outlined a solution in the issue comment if you find that you also have this problem.
use this website : http://raintomorrow.cc/post/48029438701/setup-idea-intellij-for-haxe-nme-development for some screenshots (it's an older version of intellij tho).

SDL and SFML not working with Xcode 5

I got used to VS quiet well, but hopped to Mac. OS X is fantastic, and I'm playing with Xcode now. I do not like it... For Apple related stuff it is great, but God, SFML and SDL are not working! I got same problem with both! I installed Command line Tool, and installed both Frameworks and everything, made templates, but when I build my main.cpp, it get's broken in same place. On the line #import <Foundation/Foundation.h> it says can't find Foundation/Foundation.h, and I tried adding path, and fiddling all the things in build phase, but still nothing. It is so frustrating! I can't wait for JetBrains to release their C++ IDE. Can anybody help me with these? I tried recompiling SDL2, since it was crashing Xcode but then I got that Foundation.h is missing. SFML is showing me the same thing, even if I created template and everything else is perfect. Can anybody help me?
It sounds like you need to add Foundation.framework to your Xcode project. To do that:
Click on your project's icon in the Project Navigator pane. This will show you the various targets in your project. (There's probably only 1 if you've just made the project.)
Click on the target you're trying to build, then click the "Build Phases" tab.
Twirl open the section named "Link Binary With Libraries" and click the "+" button. It will display a dialog with a list of the standard frameworks. There's a search box at the top. You can just type "Foundation" and it will find it.
Select it, and click "Add". That should add it to your target.

Xcode: code loses syntax coloring

I find that in various situations Objective-C code in Xcode 3.1 (Leopard) can fail to get appropriate syntax coloring after typing or lose coloring that it had.
This isn't just a "refresh" issue with new custom symbols -- but affects Cocoa framework symbols as well.
Sometimes CMD-a to select all text on the code page will make the coloring (re)appear, sometimes double-clicking on a line to select it will work, sometimes I have to add/delete a space in a symbol to get that symbol to (re)color. Rebuilding, or closing/reopening the project may or may not work.
Is this a known issue with Xcode? For something so annoying to me, I'm not finding the plentiful discussions of it on SO and elsewhere I'd expect.
And is there any command to force global syntax recoloring?
1.) Go to Project --> Build Settings --> Header Search Paths
2.) Add "$(SRCROOT)/**"
3.) Close and reload the project
4.) Go to Xcode --> Window --> Organizer --> Projects --> $YourProject --> Delete Derived Data
5.) Wait a moment until XCode rebuild all indicies
To get more information activate verbose logging:
1.) Increase Xcode log level in Terminal app:
defaults write com.apple.dt.Xcode IDEIndexingClangInvocationLogLevel 3
2.) Open Console app. Search for "xcode"
3.) I saw "file not found" errors for header files mentioned in the pch file (therefore the fix above)
I had the same issue with a project that was fine in Xcode 3 and for which the syntax highlighting and code completion has broken in Xcode 4. It took me the better half of the day to figure it out but I found that the following steps will reproduce / fix the issue 100% for me.
After trying all the aforementioned solutions to no avail, I tried creating the project from scratch and reimporting every file and folder painstakingly. Every time I imported a couple of files I checked and syntax highlighting still worked. Even after the last few of them it still did. Then I hit build which failed because I forgot to include a couple of common header files in the project .pch file that were there in the old project. And that was when CodeSense broke again.
After further investigation we found that if you import a header file that in turn imports the same framework header file than the .pch already does, then CodeSense will break. The same setup did not cause any issues in Xcode 3.
Example:
project.pch
#import <Foundation/Foundation.h>
#import "projectConfig.h"
projectConfig.h
#import <Foundation/Foundation.h>
#import "one.h"
#import "two.h"
So by removing the wholly unnecessary
#import <Foundation/Foundation.h>
directive from the 'projectConfig.h' you can fix the highlighting and code completion will come back for you as well. If your issue is the same as mine that is.
Just select the file who lost the syntax coloring , press Editor > Syntax Coloring > ( choose your language (Objective c++ for ex) instead of 'Default'
I have found the best way to regain syntax coloring is just to quit Xcode and re-launch it. I couldn't tell you why, but that works every time.
I find that the following will often do the trick…
"Reselect" both "Base SDK" - and "Architecture" - in "Build Settings".
(CLick on blue project icon in top left, while in "Browser mode", aka ⌘1, then click project settings and mess with the stuff there.
Make sure they all line up / it doesn't hurt to do a little toggly-wogglying up in there, while you're in there… ya know just mix it up a bit. You'll notice xCode has a teensy-tiny mini-stroke - every time you switch between 64 and 32 bit… This is usually when I know if code highlighting is dead for the night, or if I'm good to go.
Often, I will have a project that gets highlighted instantly in 32 bit mode, and just sits there in 64… Who knows.. Ahh, Xcode, you wacky botch.
Select your Project -> Build Settings tab -> Apple LLVM Language 5.0 -> Precompile Prefix Header to YES. NSLog was not highlighting. Currently running Xcode 5.0.1 Hope it helps =) Thanks #rebelzach
I can confirm a 100% fix for this problem, based on a question I had asked (and actually answered), as pictured below. One thing i will add is that sometimes it is "errant whitespace" that can also contribute to the loss of highlighting. Either clean it up yourself, or use the Goggle Toolbox for Mac Xcode 4 plugin, which adds an entry in the XCode Edit menu called Clean Up Whitespace.
This appears to be a similar error from this question
I was able to correct this issue by setting Precompile Prefix Header to No in the build settings.
I recently had a similar issue, all coloring and autocomplete stopped working for built-in frameworks, my own classes still worked. Someone recommended to me that I turn off "Run Static Analyzer" in the build settings. It's weird, but it worked.
For me it was that I renamed my project, and Tests target was still pointing to the old pch location, but my App target was pointing to the new one.
If your app delegate still has code sense, this might be the case for you too. Go into project, select the 'Tests' target search 'prefix' and set it to the equivalent value in the 'app' target.
Open the project settings (Project > Edit Project Settings menu) and then click the Rebuild Code Sense Index button in the General tab. This will recreate the index that Xcode uses for syntax coloring.
This process can take a while for larger projects, so you can check the progress in the Activity window (Window > Activity menu).
Moreover, in XCode4 there is no button to rebuild the code sense index.
I had the same problem and solved this by updating my build settings to use the system default compiler, LLVM GCC 4.2.
It seems there are multiple factors.
I experience this issue as well, and have tried the solutions either "rebuilding the index", "relaunch XCode", "change the compiler setting to LLVM GCC 4.2". Those didn't help me out.
So I tried to add the following code right away along with the fresh creation of header file.
#include "header.h"
using namespace cocos2d
Then, the code added earlier in header file is colorized, and it can recognize classes and stuff.
I've used cocos2d-x, so my syntax is based on c++. I don't test it with Objective-c yet though.
For someone still have don't know why. Let open with XCode 8.2, it should work

Getting rid of "There is no source code available for the current location."

OK, this is my own fault, but I can't seem to rescue myself.
Whenever I try to step into a class that has fields with assignments calling into .NET code, I get a dialog box that contains the text "There is no source code available for the current location.":
For instance, stepping into the constructor of the following class would give me the above message:
public class Test
{
private Stack<String> _Dummy = new Stack<String>();
public Test() { }
}
I assume this is because at some point I fiddled with the settings for the symbol server, but no matter what I fiddle with now, I can't seem to get rid of that message.
Where has my stupidity forgotten what it did?
Summary of my current options:
[ ] Enable address-level debugging
[x] Enable Just My Code (Managed Only)
[ ] Enable .NET framework source stepping
[ ] Enable source server support
Symbol file .pdb locations - empty
Cache symbols from symbol servers to this directory: C:\temp (empty)
See if some source files are accidentally excluded. Do properties of the solution and look at the Debug Source Files section under Common Properties.
In Solution Explorer, check your solution property page under Common Properties, Debug Source Files. If you see the assembly listed under "Do not look for these source files:", delete it and the issue should go away.
Open the solution property page
Check "Do not look for these source files"
If you do not want to debug .NET assembly, a quick fix to avoid "No source available to current location" problem is to uncheck "Require source files to exactly match the original version" check-box under Tool -> Options -> Debugging -> General
Here's what I did to solve this problem. First, stop debugging and just have your solution open in VS. Next, make sure your solution config is set to Debug as opposed to Release. Then simply do a Rebuild (not Build, Rebuild). The next time you fire up the debugger, it should function as normal and you shouldn't get that error message.
Hope this helps!
If you don't want this annoying tab to appear, you can try this add-on that I created:
http://erwinmayer.com/labs/visual-studio-2010-extension-disable-no-source-available-tab/
It is directly downloadable on the Visual Studio Gallery:
http://visualstudiogallery.msdn.microsoft.com/en-us/fdbb2036-471e-40a7-b20e-31f8fd5578fa
Check if your projects have a project reference, not a DLL reference! If there exists a DLL reference, your changes will not be recognized by your referenced project, and you will get an error message like yours.
This error made me go crazy as well. I was using 'AjaxControlToolkit' and had referenced it using 'Add Reference' to my project.
I deleted the 'AjaxControlToolkit' reference and added the same with 'Add Existing Item' and after that I had no problems at all...
I had the same problem in an unmanaged C++ program: when debugger was in main function it always showed "No source code available" and, what was interesting, other functions in this file was shown without problems. In this case, the problem was that I allocated too much data on the stack. After reducing it, the debugger started to work without problems.
It was in Visual Studio 2010.
One way, that also works for Express Editions of Visual Studio (say, Visual Basic 2005 Express Edition), is to rename the .suo file. It is in the same folder as the solution file, .sln. Exit Visual Studio before renaming the file.
The .suo file contains non-critical settings, like window positions, etc. However, it also contains all the breakpoints which is why it is probably better to rename it than delete it in case this action is regretted.
This is how I solved it.
Right click your project -> Properties - > Compile -> Advanced Compile Options...
Then Set 'Generate debug info' to 'Full' from the drop down menu.
Hope that helps.
This worked for me:
Check the "Enable Unmanaged Code Debugging" on the properties page for the referenced *.DLL
Recompile referenced *.DLL
Remove and then re-add the referenced *.DLL to your project
Have you tried to build that page? I had an issue with something similar with AjaxControlToolkit: Modal Popup Extender. It did not show until I gave it CSS and ASP.NET controls.
I had for some reason disabled all the Common Language Runtime Exceptions in VS 2017.
To fix this, open the Exception Settings under Debug > Windows > Exception Settings and mark the checkbox Common Language Runtime Exceptions in the Exception Settings window
I had the same issue, It showed me that the error is on AjaxControlToolkit, but the problem was in my HTML syntax, especially in a div tag, I was putting only the close tag '' without the opening tag
I ran into this problem because of difference between framework versions of test projects and main projects. When upgrading main projects frameworks version, be sure to not forget to upgrade test projects.
I had this problem in VS 2017 C++
TLDR: It was accesing data beyond the limit
The program finished in debug mode and it showed this message: wntdll.pdb not loaded
After fixing it with this answer it started to show the message: There is no source code available for the current location
But also there was a message that popped saying: app.exe has triggered a breakpoint, but the breakpoint was not in my source code, it was in the source code generated by VS in debug mode, Right click in the source code -> Go to Disassembly and the break point was int 3 instruction
At the end it was just a stack overflow, since the code was accesing data beyond the limit, I just fixed the code and the messages were gone
I guess VS didn't show an error about accesing data outside the limit because I was using Winapi function GetEnvironmentStrings() and in the site says: Treat this memory as read-only; do not modify it directly and I was modifying it :)
I had the same problem, and I solved it on this way (Visual Studio 2008):
"Formato de la informacion de depuracion" to "Base de datos de programa (/Zi)"

Resources