Assimp's aiImportFile() identifier not found - c++

Here I have my headers:
// ASSIMP
#include <assimp\Importer.hpp>
#include <assimp\scene.h>
#include <assimp\postprocess.h>
It compiles and there's no unresolved externals so my library file should be correct.
But further down:
/* load file with assimp and print some stats */
const aiScene* scene = aiImportFile(file_name, aiProcess_Triangulate);
if (!scene) {
fprintf(stderr, "ERROR: reading mesh %s\n", file_name);
return false;
}
I get an error with aiImportFile that its identifier isn't found. Which is baffling as pretty much everything else from assimp works.
How do I fix this? At the moment compiling the source code of assimp doesn't work, I don't get any library files so I'm stuck with whats available under "full".

After much work on finding a solution, I'm pretty sure the problem was compiling the library in debug mode. I believe it only works in Release mode.
Unfortunately this was a while back and don't have the code currently on my computer so I'm not 100% sure, but I am 90% sure.

Related

Node symbol lookup error opencv

I am currently writing a C++ module for node that uses open cv, and I encountered an issue that I do not quite understand. Basically this is the method that I am trying to add
void GetPuzzle(const Nan::FunctionCallbackInfo<v8::Value>& args) {
v8::String::Utf8Value parameter(args[0]->ToString());
std::string filePath = std::string(*parameter);
Mat puzzle = imread("sudoku.jpg", 0);
}
Just to make sure that the included open cv is working properly. node-gyp build works, exits with an ok , however when I am actually running the server.js file I get the following exception :
node: symbol lookup error: /home/dave/Projects/puzzlesolver/build/Release/sudokuGrabber.node: undefined symbol: _ZN2cv6imreadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEi
This is the include of the opencv :
#include <opencv2/opencv.hpp>
I guess this info is important for solving the issue - I am working on linux (ubuntu). Any suggestion of what is wrong with my code and what could I do to fix it ?

GLFW initialization fails even after successful linking

I recently started learning C++, coming primarily from Java. I know the basics now, and I want to test out some graphics. Obviously, C++ doesn't have the built in graphics API that Java does, so I'm trying my hand at using GLFW. Unfortunately, I can't even get it to initialize with glfwInit(). Here's my code (it logs "Could not initialize GLFW" to the console):
#include <GLFW\glfw3.h>
#include <iostream>
int main() {
if (!glfwInit()) {
std::cout << "Could not initialize GLFW" << std::endl;
}
else {
std::cout << "GLFW initialized!" << std::endl;
glfwTerminate();
}
std::cin.get();
return 0;
}
I've seen lots of similar test code before, so I'm assuming that the code is the issue. I'm also not getting any linking errors, so I think I did that properly. However, this is essentially the first time I've used a third party library with C++, so I could be making a simple mistake.
I'm using Visual Studio Community 2015, but since GLFW doesn't have any pre-built binaries for that yet, I had to build them myself with CMake. (Since I've never done that before, I repeated this whole process in Visual Studio Community 2013 with the pre-built binaries, and I got the same result.) I added my 'lib' and 'include' folders in the appropriate places in Configuration Properties -> VC++ Directories, and I added the 'glfw3.lib' and 'opengl32.lib' files in Linker -> Input -> Additional Dependencies.
I've found an abundance of posts where people have linking errors (which I don't have anymore) or can't get GLFW working even when initialization succeeds. However, I haven't been able to find anyone else with a problem quite like mine, nor do I know where to start in terms of debugging. Any help is greatly appreciated.
Okay, so apparently this was a bug in GLFW. I added an error callback and it returned "No monitors found." I found this discussion of a similar issue on the GLFW github page, and the owner added a fix recently that hasn't made its way into any official release. I downloaded the master branch, built it as I had before, replaced the libs and header files, and now everything works properly.

C++: Why does libtiff break the console-output?

So finally I’m not able to help myself out by researching anymore. Hopefully you can help me.
I recently decided to learn C++ in the context of my bachelor-thesis: My first aim is to read the pixel-values of a tiff-image with the libtiff-library. Yet, every call of a function of the library seems to break parts of my program.
Here’s the simple “HelloWorld”-Program, it works as it should:
#include "tiffio.h"
#include <iostream>
using namespace std;
int main() {
cout << "Hello" << endl;
// TIFF* tif = TIFFOpen("path to .tif", "r");
return 0;
}
When I uncomment the second line in main(), the code still does compile without errors (except the warning that ‘tif’ isn’t used) and I can start the program as usual. Yet nothing gets printed into the console anymore. Not “Hello” nor any errors.
Any suggestions where the error could be? The code should be alright, I guess I messed something up during the setup of the library or so. Here’s what I did:
I managed to set up eclipse (Mars, 32bit) for C++ and MinGW (32bit) on my 64bit Win7, then downloaded libtiff 4.0.4 and built it following this instruction.
I created a new C++-project with the mentioned code and did the following adjustments in the project-properties:
Project->Properties->C/C++ General->Paths and Symbols->Library
Paths-> Added “D:/… /tiff-4.0.4/libtiff/.libs”
Project->Properties->C/C++ Build->MinGW C++
Linker->Miscellaneous->Set Linkerflags to “-static-libgcc
-static-libstdc++”
Project->Properties->C/C++ Build->MinGW C++ Linker->Libraries-> Set
(-L) to “D:/… /tiff-4.0.4/libtiff/.libs” and (-l) to “libtiff”
I know the .tif is a valid file as I implemented parts of my program in C#, using the LibTiff.NET library by BitMiracle.
Thank you in advance!
Edit 1: The same error occures, even if TIFF* tif = TIFFOpen("path to .tif", "r"); is never called but written down in a dead part of the code. Debugging does not work either, the program seems to be terminated (exit value 0) before a single line is executed, without any error-reports.
I had the same issue and managed to get rid of it.
I set up eclipse (Mars) for C++ and MinGW on my 64bit Win7, then downloaded libtiff 4.0.4 and built it following this instruction.
After the build, I got two directories containing files:
include
tiff.h
tiffconf.h
tiffio.h
tiffio.hxx
tiffvers.h
lib
libtiff.a
libtiff.dll.a
libtiff.la
libtiffxx.a
libtiffxx.dll.a
libtiffxx.la
I also linked all include files and only the libtiff.a to my project and that solved it, ie, the other lines are now executed.
I hope, I helped with this post.

How do I include GLFW 3.x, without errors?

I have downloaded GLFW 3.1.1(glfw-3.1.1.zip) to my computer.
I want to execute this code:
#include <GLFW/glfw3.h>
int main()
{
return 0;
}
In other words, I just want to be able to include GLFW in my code, so that I later on can open a context (for openGL use).
But I get this error message when running the code:
Error 1 error C1083: Cannot open include file: 'GLFW/glfw3.h': No such file or directory f:\opengl_coding\video_tut_test\video_tut_test\main.cpp 1 1 Video_tut_test
I know that there is a step that I haven't done, but I don't understand what this step is. Is it linking? I see this being talked a lot about in tutorials, but they never explain it properly.
How do I remove the error and make it possible to execute the above code?
I use Visual Studio Express 2013, on a Windows 8 machine.
I come from a Java background.

The procedure entry point _gxx_personality_v0 could not be located in the dynamic link library libstdc++-6.dll Error

Yesterday I decided to download, install, and attempt to use Allegro 5. I also downloaded Code::Blocks 12.11 w/ the MinGW compiler. I set up everything and installed everything correctly (or so I thought) and tried to run a sample code to see if it would work:
#include <stdio.h>
#include <allegro5/allegro.h>
int main(int argc, char **argv){
ALLEGRO_DISPLAY *display = NULL;
if(!al_init()) {
fprintf(stderr, "failed to initialize allegro!\n");
return -1;
}
display = al_create_display(640, 480);
if(!display) {
fprintf(stderr, "failed to create display!\n");
return -1;
}
al_clear_to_color(al_map_rgb(0,0,0));
al_flip_display();
al_rest(10.0);
al_destroy_display(display);
return 0;
}
When I attempt to compile and run the program an error message box appears saying "The procedure entry point _gxx_personality_v0 could not be located in the dynamic link library libstdc++-6.dll." I searched the web for about an hour trying to find a fix for this problem, like I do for most things, but I came up empty handed. I'm wondering if anyone has any ideas for any fixes to this problem, if so, let me know ASAP! Thanks in advance!
__gxx_personality_v0 is used in the exception handling of the C++ library. MinGW can support a couple different exception models on the x86: sjlj (setjmp/longjmp) or DWARF (DW2). As far as I know, which model will be used is compiled into the compiler - it's not something that can be selected with a command line option.
The sjlj exception model will link to __gxx_personality_sj0, the DW2 exception model links to __gxx_personality_v0. It seems like your compiler is building for the dw2 exception model, but at runtime it's finding a libstdc++-6.dll that was built with the sjlj model. See if you have multiple versions of libstdc++-6.dll on youR system, and see if copying another one to the same directory as your program fixes the problem.
You can use nm libstdc++-6.dll | grep personality to see which exception 'personality' the DLL is using.
I ran into this as well. Did some searching, someone mentioned paying attention to whether or not you were in Debug or Release Mode. This applies to Code::Blocks specifically. I found I was in Debug Mode. I changed that to Release Mode and my program compiled and ran.
I am troubled by this though... It seems to me it should work in both modes, so how do I fix it so that it will? I have no answer there. Maybe someone will comment with the solution. In the meantime, compile and run in Release Mode instead of Debug Mode.
I just did a little mad science, removed the libstdc++6.dll from MinGW/bin and put it in another folder. Then I copied over the same file from Gimp/bin. No more linker error, instead I get an error that says the application failed to start :( Still compiles and runs in Release Mode though.